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

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_unittest.cc

Issue 1296663003: Componentize proxy code from chrome/browser/net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updating for win p/f Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
12 #include "chrome/common/pref_names.h"
13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf ig_test_utils.h" 12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf ig_test_utils.h"
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h" 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h"
15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 14 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
16 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s_test_utils.h" 15 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s_test_utils.h"
16 #include "components/proxy_config/proxy_config_pref_names.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using testing::_; 19 using testing::_;
20 using testing::Return; 20 using testing::Return;
21 21
22 class DataReductionProxyChromeSettingsTest : public testing::Test { 22 class DataReductionProxyChromeSettingsTest : public testing::Test {
23 public: 23 public:
24 void SetUp() override { 24 void SetUp() override {
25 drp_chrome_settings_ = 25 drp_chrome_settings_ =
26 make_scoped_ptr(new DataReductionProxyChromeSettings()); 26 make_scoped_ptr(new DataReductionProxyChromeSettings());
27 test_context_ = 27 test_context_ =
28 data_reduction_proxy::DataReductionProxyTestContext::Builder() 28 data_reduction_proxy::DataReductionProxyTestContext::Builder()
29 .WithMockConfig() 29 .WithMockConfig()
30 .SkipSettingsInitialization() 30 .SkipSettingsInitialization()
31 .Build(); 31 .Build();
32 config_ = test_context_->mock_config(); 32 config_ = test_context_->mock_config();
33 drp_chrome_settings_->ResetConfigForTest(config_); 33 drp_chrome_settings_->ResetConfigForTest(config_);
34 dict_ = make_scoped_ptr(new base::DictionaryValue()); 34 dict_ = make_scoped_ptr(new base::DictionaryValue());
35 35
36 PrefRegistrySimple* registry = test_context_->pref_service()->registry(); 36 PrefRegistrySimple* registry = test_context_->pref_service()->registry();
37 registry->RegisterDictionaryPref(prefs::kProxy); 37 registry->RegisterDictionaryPref(proxy_config::prefs::kProxy);
38 } 38 }
39 39
40 base::MessageLoopForIO message_loop_; 40 base::MessageLoopForIO message_loop_;
41 scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_; 41 scoped_ptr<DataReductionProxyChromeSettings> drp_chrome_settings_;
42 scoped_ptr<base::DictionaryValue> dict_; 42 scoped_ptr<base::DictionaryValue> dict_;
43 scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> test_context_; 43 scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> test_context_;
44 data_reduction_proxy::MockDataReductionProxyConfig* config_; 44 data_reduction_proxy::MockDataReductionProxyConfig* config_;
45 }; 45 };
46 46
47 TEST_F(DataReductionProxyChromeSettingsTest, MigrateNonexistentProxyPref) { 47 TEST_F(DataReductionProxyChromeSettingsTest, MigrateNonexistentProxyPref) {
48 base::HistogramTester histogram_tester; 48 base::HistogramTester histogram_tester;
49 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); 49 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
50 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 50 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
51 test_context_->pref_service()); 51 test_context_->pref_service());
52 52
53 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy)); 53 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(
54 proxy_config::prefs::kProxy));
54 histogram_tester.ExpectUniqueSample( 55 histogram_tester.ExpectUniqueSample(
55 "DataReductionProxy.ProxyPrefMigrationResult", 56 "DataReductionProxy.ProxyPrefMigrationResult",
56 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1); 57 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1);
57 } 58 }
58 59
59 TEST_F(DataReductionProxyChromeSettingsTest, MigrateBadlyFormedProxyPref) { 60 TEST_F(DataReductionProxyChromeSettingsTest, MigrateBadlyFormedProxyPref) {
60 const struct { 61 const struct {
61 // NULL indicates that mode is unset. 62 // NULL indicates that mode is unset.
62 const char* proxy_mode_string; 63 const char* proxy_mode_string;
63 // NULL indicates that server is unset. 64 // NULL indicates that server is unset.
64 const char* proxy_server_string; 65 const char* proxy_server_string;
65 } test_cases[] = { 66 } test_cases[] = {
66 // The pref should not be cleared if mode is unset. 67 // The pref should not be cleared if mode is unset.
67 {nullptr, "http=compress.googlezip.net"}, 68 {nullptr, "http=compress.googlezip.net"},
68 // The pref should not be cleared for modes other than "fixed_servers" and 69 // The pref should not be cleared for modes other than "fixed_servers" and
69 // "pac_script". 70 // "pac_script".
70 {"auto_detect", "http=compress.googlezip.net"}, 71 {"auto_detect", "http=compress.googlezip.net"},
71 // The pref should not be cleared when the server field is unset. 72 // The pref should not be cleared when the server field is unset.
72 {"fixed_servers", nullptr}, 73 {"fixed_servers", nullptr},
73 }; 74 };
74 75
75 for (const auto& test : test_cases) { 76 for (const auto& test : test_cases) {
76 base::HistogramTester histogram_tester; 77 base::HistogramTester histogram_tester;
77 dict_.reset(new base::DictionaryValue()); 78 dict_.reset(new base::DictionaryValue());
78 if (test.proxy_mode_string) 79 if (test.proxy_mode_string)
79 dict_->SetString("mode", test.proxy_mode_string); 80 dict_->SetString("mode", test.proxy_mode_string);
80 if (test.proxy_server_string) 81 if (test.proxy_server_string)
81 dict_->SetString("server", test.proxy_server_string); 82 dict_->SetString("server", test.proxy_server_string);
82 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 83 test_context_->pref_service()->Set(proxy_config::prefs::kProxy,
84 *dict_.get());
83 85
84 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); 86 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
85 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 87 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
86 test_context_->pref_service()); 88 test_context_->pref_service());
87 89
88 const base::DictionaryValue* final_value; 90 const base::DictionaryValue* final_value;
89 test_context_->pref_service() 91 test_context_->pref_service()
90 ->GetUserPref(prefs::kProxy) 92 ->GetUserPref(proxy_config::prefs::kProxy)
91 ->GetAsDictionary(&final_value); 93 ->GetAsDictionary(&final_value);
92 EXPECT_NE(nullptr, final_value); 94 EXPECT_NE(nullptr, final_value);
93 EXPECT_TRUE(dict_->Equals(final_value)); 95 EXPECT_TRUE(dict_->Equals(final_value));
94 96
95 histogram_tester.ExpectUniqueSample( 97 histogram_tester.ExpectUniqueSample(
96 "DataReductionProxy.ProxyPrefMigrationResult", 98 "DataReductionProxy.ProxyPrefMigrationResult",
97 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1); 99 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1);
98 } 100 }
99 } 101 }
100 102
101 TEST_F(DataReductionProxyChromeSettingsTest, MigrateEmptyProxy) { 103 TEST_F(DataReductionProxyChromeSettingsTest, MigrateEmptyProxy) {
102 base::HistogramTester histogram_tester; 104 base::HistogramTester histogram_tester;
103 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 105 test_context_->pref_service()->Set(proxy_config::prefs::kProxy, *dict_.get());
104 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); 106 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
105 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 107 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
106 test_context_->pref_service()); 108 test_context_->pref_service());
107 109
108 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy)); 110 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(
111 proxy_config::prefs::kProxy));
109 histogram_tester.ExpectUniqueSample( 112 histogram_tester.ExpectUniqueSample(
110 "DataReductionProxy.ProxyPrefMigrationResult", 113 "DataReductionProxy.ProxyPrefMigrationResult",
111 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_EMPTY, 1); 114 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_EMPTY, 1);
112 } 115 }
113 116
114 TEST_F(DataReductionProxyChromeSettingsTest, MigrateSystemProxy) { 117 TEST_F(DataReductionProxyChromeSettingsTest, MigrateSystemProxy) {
115 base::HistogramTester histogram_tester; 118 base::HistogramTester histogram_tester;
116 dict_->SetString("mode", "system"); 119 dict_->SetString("mode", "system");
117 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 120 test_context_->pref_service()->Set(proxy_config::prefs::kProxy, *dict_.get());
118 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); 121 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
119 122
120 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 123 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
121 test_context_->pref_service()); 124 test_context_->pref_service());
122 125
123 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy)); 126 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(
127 proxy_config::prefs::kProxy));
124 histogram_tester.ExpectUniqueSample( 128 histogram_tester.ExpectUniqueSample(
125 "DataReductionProxy.ProxyPrefMigrationResult", 129 "DataReductionProxy.ProxyPrefMigrationResult",
126 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_MODE_SYSTEM, 1); 130 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_MODE_SYSTEM, 1);
127 } 131 }
128 132
129 TEST_F(DataReductionProxyChromeSettingsTest, MigrateDataReductionProxy) { 133 TEST_F(DataReductionProxyChromeSettingsTest, MigrateDataReductionProxy) {
130 const std::string kTestServers[] = {"http=http://proxy.googlezip.net", 134 const std::string kTestServers[] = {"http=http://proxy.googlezip.net",
131 "http=https://my-drp.org", 135 "http=https://my-drp.org",
132 "https=https://tunneldrp.com"}; 136 "https=https://tunneldrp.com"};
133 137
134 for (const std::string& test_server : kTestServers) { 138 for (const std::string& test_server : kTestServers) {
135 base::HistogramTester histogram_tester; 139 base::HistogramTester histogram_tester;
136 dict_.reset(new base::DictionaryValue()); 140 dict_.reset(new base::DictionaryValue());
137 dict_->SetString("mode", "fixed_servers"); 141 dict_->SetString("mode", "fixed_servers");
138 dict_->SetString("server", test_server); 142 dict_->SetString("server", test_server);
139 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 143 test_context_->pref_service()->Set(proxy_config::prefs::kProxy,
144 *dict_.get());
140 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)) 145 EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
141 .Times(1) 146 .Times(1)
142 .WillOnce(Return(true)); 147 .WillOnce(Return(true));
143 148
144 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 149 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
145 test_context_->pref_service()); 150 test_context_->pref_service());
146 151
147 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy)); 152 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(
153 proxy_config::prefs::kProxy));
148 histogram_tester.ExpectUniqueSample( 154 histogram_tester.ExpectUniqueSample(
149 "DataReductionProxy.ProxyPrefMigrationResult", 155 "DataReductionProxy.ProxyPrefMigrationResult",
150 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_DRP, 1); 156 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_DRP, 1);
151 } 157 }
152 } 158 }
153 159
154 TEST_F(DataReductionProxyChromeSettingsTest, 160 TEST_F(DataReductionProxyChromeSettingsTest,
155 MigrateGooglezipDataReductionProxy) { 161 MigrateGooglezipDataReductionProxy) {
156 const std::string kTestServers[] = { 162 const std::string kTestServers[] = {
157 "http=http://proxy-dev.googlezip.net", 163 "http=http://proxy-dev.googlezip.net",
158 "http=https://arbitraryprefix.googlezip.net", 164 "http=https://arbitraryprefix.googlezip.net",
159 "https=https://tunnel.googlezip.net"}; 165 "https=https://tunnel.googlezip.net"};
160 166
161 for (const std::string& test_server : kTestServers) { 167 for (const std::string& test_server : kTestServers) {
162 base::HistogramTester histogram_tester; 168 base::HistogramTester histogram_tester;
163 dict_.reset(new base::DictionaryValue()); 169 dict_.reset(new base::DictionaryValue());
164 // The proxy pref is set to a Data Reduction Proxy that doesn't match the 170 // The proxy pref is set to a Data Reduction Proxy that doesn't match the
165 // currently configured DRP, but the pref should still be cleared. 171 // currently configured DRP, but the pref should still be cleared.
166 dict_->SetString("mode", "fixed_servers"); 172 dict_->SetString("mode", "fixed_servers");
167 dict_->SetString("server", test_server); 173 dict_->SetString("server", test_server);
168 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 174 test_context_->pref_service()->Set(proxy_config::prefs::kProxy,
175 *dict_.get());
169 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)) 176 EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
170 .Times(1) 177 .Times(1)
171 .WillOnce(Return(false)); 178 .WillOnce(Return(false));
172 179
173 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 180 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
174 test_context_->pref_service()); 181 test_context_->pref_service());
175 182
176 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(prefs::kProxy)); 183 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(
184 proxy_config::prefs::kProxy));
177 histogram_tester.ExpectUniqueSample( 185 histogram_tester.ExpectUniqueSample(
178 "DataReductionProxy.ProxyPrefMigrationResult", 186 "DataReductionProxy.ProxyPrefMigrationResult",
179 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_GOOGLEZIP, 1); 187 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_GOOGLEZIP, 1);
180 } 188 }
181 } 189 }
182 190
183 TEST_F(DataReductionProxyChromeSettingsTest, 191 TEST_F(DataReductionProxyChromeSettingsTest,
184 MigratePacGooglezipDataReductionProxy) { 192 MigratePacGooglezipDataReductionProxy) {
185 const struct { 193 const struct {
186 const char* pac_url; 194 const char* pac_url;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 false}, 258 false},
251 // PAC URL that doesn't embed a script. 259 // PAC URL that doesn't embed a script.
252 {"http://compress.googlezip.net/pac", false}, 260 {"http://compress.googlezip.net/pac", false},
253 }; 261 };
254 262
255 for (const auto& test : test_cases) { 263 for (const auto& test : test_cases) {
256 base::HistogramTester histogram_tester; 264 base::HistogramTester histogram_tester;
257 dict_.reset(new base::DictionaryValue()); 265 dict_.reset(new base::DictionaryValue());
258 dict_->SetString("mode", "pac_script"); 266 dict_->SetString("mode", "pac_script");
259 dict_->SetString("pac_url", test.pac_url); 267 dict_->SetString("pac_url", test.pac_url);
260 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 268 test_context_->pref_service()->Set(proxy_config::prefs::kProxy,
269 *dict_.get());
261 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0); 270 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)).Times(0);
262 271
263 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 272 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
264 test_context_->pref_service()); 273 test_context_->pref_service());
265 274
266 if (test.expect_pref_cleared) { 275 if (test.expect_pref_cleared) {
267 EXPECT_EQ(NULL, 276 EXPECT_EQ(NULL, test_context_->pref_service()->GetUserPref(
268 test_context_->pref_service()->GetUserPref(prefs::kProxy)); 277 proxy_config::prefs::kProxy));
269 histogram_tester.ExpectUniqueSample( 278 histogram_tester.ExpectUniqueSample(
270 "DataReductionProxy.ProxyPrefMigrationResult", 279 "DataReductionProxy.ProxyPrefMigrationResult",
271 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_PAC_GOOGLEZIP, 280 DataReductionProxyChromeSettings::PROXY_PREF_CLEARED_PAC_GOOGLEZIP,
272 1); 281 1);
273 } else { 282 } else {
274 const base::DictionaryValue* value; 283 const base::DictionaryValue* value;
275 EXPECT_TRUE(test_context_->pref_service() 284 EXPECT_TRUE(test_context_->pref_service()
276 ->GetUserPref(prefs::kProxy) 285 ->GetUserPref(proxy_config::prefs::kProxy)
277 ->GetAsDictionary(&value)); 286 ->GetAsDictionary(&value));
278 std::string mode; 287 std::string mode;
279 EXPECT_TRUE(value->GetString("mode", &mode)); 288 EXPECT_TRUE(value->GetString("mode", &mode));
280 EXPECT_EQ("pac_script", mode); 289 EXPECT_EQ("pac_script", mode);
281 std::string pac_url; 290 std::string pac_url;
282 EXPECT_TRUE(value->GetString("pac_url", &pac_url)); 291 EXPECT_TRUE(value->GetString("pac_url", &pac_url));
283 EXPECT_EQ(test.pac_url, pac_url); 292 EXPECT_EQ(test.pac_url, pac_url);
284 293
285 histogram_tester.ExpectUniqueSample( 294 histogram_tester.ExpectUniqueSample(
286 "DataReductionProxy.ProxyPrefMigrationResult", 295 "DataReductionProxy.ProxyPrefMigrationResult",
287 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1); 296 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1);
288 } 297 }
289 } 298 }
290 } 299 }
291 300
292 TEST_F(DataReductionProxyChromeSettingsTest, MigrateIgnoreOtherProxy) { 301 TEST_F(DataReductionProxyChromeSettingsTest, MigrateIgnoreOtherProxy) {
293 const std::string kTestServers[] = { 302 const std::string kTestServers[] = {
294 "http=https://youtube.com", 303 "http=https://youtube.com",
295 "http=http://googlezip.net", 304 "http=http://googlezip.net",
296 "http=http://thisismyproxynotgooglezip.net", 305 "http=http://thisismyproxynotgooglezip.net",
297 "https=http://arbitraryprefixgooglezip.net"}; 306 "https=http://arbitraryprefixgooglezip.net"};
298 307
299 for (const std::string& test_server : kTestServers) { 308 for (const std::string& test_server : kTestServers) {
300 base::HistogramTester histogram_tester; 309 base::HistogramTester histogram_tester;
301 dict_.reset(new base::DictionaryValue()); 310 dict_.reset(new base::DictionaryValue());
302 dict_->SetString("mode", "fixed_servers"); 311 dict_->SetString("mode", "fixed_servers");
303 dict_->SetString("server", test_server); 312 dict_->SetString("server", test_server);
304 test_context_->pref_service()->Set(prefs::kProxy, *dict_.get()); 313 test_context_->pref_service()->Set(proxy_config::prefs::kProxy,
314 *dict_.get());
305 EXPECT_CALL(*config_, ContainsDataReductionProxy(_)) 315 EXPECT_CALL(*config_, ContainsDataReductionProxy(_))
306 .Times(1) 316 .Times(1)
307 .WillOnce(Return(false)); 317 .WillOnce(Return(false));
308 318
309 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs( 319 drp_chrome_settings_->MigrateDataReductionProxyOffProxyPrefs(
310 test_context_->pref_service()); 320 test_context_->pref_service());
311 321
312 base::DictionaryValue* value = 322 base::DictionaryValue* value =
313 (base::DictionaryValue*)test_context_->pref_service()->GetUserPref( 323 (base::DictionaryValue*)test_context_->pref_service()->GetUserPref(
314 prefs::kProxy); 324 proxy_config::prefs::kProxy);
315 std::string mode; 325 std::string mode;
316 EXPECT_TRUE(value->GetString("mode", &mode)); 326 EXPECT_TRUE(value->GetString("mode", &mode));
317 EXPECT_EQ("fixed_servers", mode); 327 EXPECT_EQ("fixed_servers", mode);
318 std::string server; 328 std::string server;
319 EXPECT_TRUE(value->GetString("server", &server)); 329 EXPECT_TRUE(value->GetString("server", &server));
320 EXPECT_EQ(test_server, server); 330 EXPECT_EQ(test_server, server);
321 331
322 histogram_tester.ExpectUniqueSample( 332 histogram_tester.ExpectUniqueSample(
323 "DataReductionProxy.ProxyPrefMigrationResult", 333 "DataReductionProxy.ProxyPrefMigrationResult",
324 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1); 334 DataReductionProxyChromeSettings::PROXY_PREF_NOT_CLEARED, 1);
325 } 335 }
326 } 336 }
OLDNEW
« no previous file with comments | « chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698