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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc

Issue 1310743003: Consistently use LoFi for an entire page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 5 years, 4 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
index 7f8e7f14848a78e60b69463fc4b096be7a0b48d7..bdc99a28557ade369961a7213f169ab4ae4b694b 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc
@@ -339,8 +339,7 @@ TEST_F(DataReductionProxySettingsTest, TestLoFiImplicitOptOutClicksPerSession) {
prefs::kLoFiLoadImagesPerSession));
EXPECT_EQ(0, test_context_->pref_service()->GetInteger(
prefs::kLoFiSnackbarsShownPerSession));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
// Click "Load images" |lo_fi_user_requests_for_images_per_session_| times.
for (int i = 1; i <= settings_->lo_fi_user_requests_for_images_per_session_;
@@ -357,8 +356,7 @@ TEST_F(DataReductionProxySettingsTest, TestLoFiImplicitOptOutClicksPerSession) {
test_context_->RunUntilIdle();
EXPECT_EQ(1, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_TRUE(test_context_->config()->IsLoFiOff());
// Reset the opt out pref values and config Lo-Fi status as if we're starting
// a new session.
@@ -370,8 +368,7 @@ TEST_F(DataReductionProxySettingsTest, TestLoFiImplicitOptOutClicksPerSession) {
prefs::kLoFiSnackbarsShownPerSession));
EXPECT_EQ(1, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
// Don't show any snackbars or have any "Load images" requests, but start
// a new session. kLoFiConsecutiveSessionDisables should not reset since
@@ -384,8 +381,7 @@ TEST_F(DataReductionProxySettingsTest, TestLoFiImplicitOptOutClicksPerSession) {
prefs::kLoFiSnackbarsShownPerSession));
EXPECT_EQ(1, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
// Have a session that doesn't have
// |lo_fi_user_requests_for_images_per_session_|, but has that number of
@@ -410,8 +406,7 @@ TEST_F(DataReductionProxySettingsTest, TestLoFiImplicitOptOutClicksPerSession) {
// should have been set to off.
EXPECT_EQ(1, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
// Start a new session. The consecutive session count should now be reset to
// zero.
@@ -430,16 +425,14 @@ TEST_F(DataReductionProxySettingsTest,
prefs::kLoFiLoadImagesPerSession));
EXPECT_EQ(0, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
// Disable Lo-Fi for |lo_fi_consecutive_session_disables_|.
for (int i = 1; i <= settings_->lo_fi_consecutive_session_disables_; ++i) {
// Start a new session.
test_context_->config()->ResetLoFiStatusForTest();
settings_->data_reduction_proxy_service_->InitializeLoFiPrefs();
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
// Click "Load images" |lo_fi_user_requests_for_images_per_session_| times
// for each session.
@@ -457,8 +450,7 @@ TEST_F(DataReductionProxySettingsTest,
test_context_->RunUntilIdle();
EXPECT_EQ(i, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_TRUE(test_context_->config()->IsLoFiOff());
}
// Start a new session. Lo-Fi should be set off.
@@ -467,8 +459,7 @@ TEST_F(DataReductionProxySettingsTest,
test_context_->RunUntilIdle();
EXPECT_EQ(3, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_TRUE(test_context_->config()->IsLoFiOff());
// Set the implicit opt out epoch to -1 so that the default value of zero will
// be an increase and the opt out status will be reset.
@@ -481,8 +472,7 @@ TEST_F(DataReductionProxySettingsTest,
test_context_->RunUntilIdle();
EXPECT_EQ(0, test_context_->pref_service()->GetInteger(
prefs::kLoFiConsecutiveSessionDisables));
- EXPECT_EQ(LoFiStatus::LOFI_STATUS_TEMPORARILY_OFF,
- test_context_->config()->GetLoFiStatus());
+ EXPECT_FALSE(test_context_->config()->IsLoFiOff());
}
TEST_F(DataReductionProxySettingsTest, TestLoFiImplicitOptOutHistograms) {

Powered by Google App Engine
This is Rietveld 408576698