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

Unified Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc

Issue 669163003: Handle disabling data reduction proxy for all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed bengr's changes Created 6 years, 2 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: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc
index 06848fa2102af08b986dfc3abe8001758ae6b0d9..260f6cc49e42451e67ae45a97b8e692a7662bef4 100644
--- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc
@@ -8,10 +8,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_registry_simple.h"
+#include "base/prefs/scoped_user_pref_update.h"
#include "base/prefs/testing_pref_service.h"
#include "base/test/test_simple_task_runner.h"
#include "base/values.h"
#include "chrome/common/pref_names.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_params.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -45,6 +47,12 @@ class DataReductionProxyConfigTest : public testing::Test {
scoped_ptr<DataReductionProxyChromeConfigurator> config_;
TestingPrefServiceSimple pref_service_;
+ const int drp_flag =
+ data_reduction_proxy::DataReductionProxyParams::kAllowed |
+ data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed |
+ data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed |
+ data_reduction_proxy::DataReductionProxyParams::
+ kAlternativeFallbackAllowed;
};
TEST_F(DataReductionProxyConfigTest, TestUnrestricted) {
@@ -116,6 +124,10 @@ TEST_F(DataReductionProxyConfigTest, TestFallbackRestricted) {
}
TEST_F(DataReductionProxyConfigTest, TestBothRestricted) {
+ DictionaryPrefUpdate update(&pref_service_, prefs::kProxy);
+ base::DictionaryValue* dict = update.Get();
+ dict->SetString("mode", "system");
+
config_->Enable(true,
true,
"https://www.foo.com:443/",
@@ -125,10 +137,34 @@ TEST_F(DataReductionProxyConfigTest, TestBothRestricted) {
}
TEST_F(DataReductionProxyConfigTest, TestDisable) {
+ data_reduction_proxy::DataReductionProxyParams params(drp_flag);
+ config_->Enable(false,
+ false,
+ params.origin().spec(),
+ params.fallback_origin().spec(),
+ "");
config_->Disable();
CheckProxyConfig("system", "", "");
}
+TEST_F(DataReductionProxyConfigTest, TestDisableWithUserOverride) {
+ data_reduction_proxy::DataReductionProxyParams params(drp_flag);
+ config_->Enable(false,
+ false,
+ params.origin().spec(),
+ params.fallback_origin().spec(),
+ "");
+
+ // Override the data reduction proxy.
+ DictionaryPrefUpdate update(&pref_service_, prefs::kProxy);
+ base::DictionaryValue* dict = update.Get();
+ dict->SetString("server", "https://www.baz.com:22/");
+
+ // This should have no effect since proxy server was overridden.
+ config_->Disable();
+
+ CheckProxyConfig("fixed_servers", "https://www.baz.com:22/", "");
+}
TEST_F(DataReductionProxyConfigTest, TestBypassList) {
config_->AddHostPatternToBypass("http://www.google.com");

Powered by Google App Engine
This is Rietveld 408576698