Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6780)

Unified Diff: chrome/browser/previews/previews_service_unittest.cc

Issue 2963553002: Makes PreviewsService IsPreviewsTypeEnabled aware of new CPAT Feature (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/previews/previews_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/previews/previews_service_unittest.cc
diff --git a/chrome/browser/previews/previews_service_unittest.cc b/chrome/browser/previews/previews_service_unittest.cc
index 39d8f8c1733d5758cc1c028634f2313c40f71727..f2b7e07fc9a957a816f1cb2255c3e4ddd668e77b 100644
--- a/chrome/browser/previews/previews_service_unittest.cc
+++ b/chrome/browser/previews/previews_service_unittest.cc
@@ -16,6 +16,8 @@
#include "base/metrics/field_trial_params.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/test/scoped_feature_list.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_features.h"
#include "components/previews/core/previews_io_data.h"
#include "components/previews/core/previews_ui_service.h"
#include "components/variations/variations_associated_data.h"
@@ -66,7 +68,7 @@ class PreviewsServiceTest : public testing::Test {
public:
PreviewsServiceTest()
- : field_trial_list_(nullptr) {}
+ : field_trial_list_(nullptr), scoped_feature_list_() {}
void SetUp() override {
io_data_ = base::MakeUnique<TestPreviewsIOData>();
@@ -77,6 +79,8 @@ class PreviewsServiceTest : public testing::Test {
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::UI),
file_path);
+ scoped_feature_list_.InitAndDisableFeature(
+ data_reduction_proxy::features::kDataReductionProxyDecidesTransform);
}
void TearDown() override { variations::testing::ClearAllVariationParams(); }
@@ -90,6 +94,7 @@ class PreviewsServiceTest : public testing::Test {
base::FieldTrialList field_trial_list_;
std::unique_ptr<TestPreviewsIOData> io_data_;
std::unique_ptr<PreviewsService> service_;
+ base::test::ScopedFeatureList scoped_feature_list_;
};
} // namespace
@@ -146,6 +151,9 @@ TEST_F(PreviewsServiceTest, TestServerLoFiFieldTrialNotSet) {
}
TEST_F(PreviewsServiceTest, TestLitePageFieldTrialEnabledPreview) {
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitAndDisableFeature(
+ data_reduction_proxy::features::kDataReductionProxyDecidesTransform);
base::FieldTrialList::CreateFieldTrial("DataCompressionProxyLoFi",
"Enabled_Preview");
EXPECT_TRUE(io_data()->IsPreviewEnabled(previews::PreviewsType::LITE_PAGE));
@@ -165,3 +173,17 @@ TEST_F(PreviewsServiceTest, TestLitePageFieldTrialDisabled) {
TEST_F(PreviewsServiceTest, TestLitePageFieldTrialNotSet) {
EXPECT_FALSE(io_data()->IsPreviewEnabled(previews::PreviewsType::LITE_PAGE));
}
+
+TEST_F(PreviewsServiceTest, TestServerLoFiProxyDecidesTransform) {
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitAndEnableFeature(
+ data_reduction_proxy::features::kDataReductionProxyDecidesTransform);
+ EXPECT_TRUE(io_data()->IsPreviewEnabled(previews::PreviewsType::LITE_PAGE));
+}
+
+TEST_F(PreviewsServiceTest, TestLitePageProxyDecidesTransform) {
+ base::test::ScopedFeatureList scoped_feature_list;
+ scoped_feature_list.InitAndEnableFeature(
+ data_reduction_proxy::features::kDataReductionProxyDecidesTransform);
+ EXPECT_TRUE(io_data()->IsPreviewEnabled(previews::PreviewsType::LITE_PAGE));
+}
« no previous file with comments | « chrome/browser/previews/previews_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698