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

Side by Side Diff: chrome/browser/extensions/extension_proxy_apitest.cc

Issue 6450006: Migrate Proxy Settings API to net::ProxyServer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/out/Debug
Patch Set: Nits Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/prefs/pref_service.h" 6 #include "chrome/browser/prefs/pref_service.h"
7 #include "chrome/browser/prefs/proxy_config_dictionary.h" 7 #include "chrome/browser/prefs/proxy_config_dictionary.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividual) { 140 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividual) {
141 CommandLine::ForCurrentProcess()->AppendSwitch( 141 CommandLine::ForCurrentProcess()->AppendSwitch(
142 switches::kEnableExperimentalExtensionApis); 142 switches::kEnableExperimentalExtensionApis);
143 143
144 ASSERT_TRUE(RunExtensionTest("proxy/individual")) << message_; 144 ASSERT_TRUE(RunExtensionTest("proxy/individual")) << message_;
145 const Extension* extension = GetSingleLoadedExtension(); 145 const Extension* extension = GetSingleLoadedExtension();
146 ASSERT_TRUE(extension); 146 ASSERT_TRUE(extension);
147 147
148 PrefService* pref_service = browser()->profile()->GetPrefs(); 148 PrefService* pref_service = browser()->profile()->GetPrefs();
149 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS, 149 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS,
150 "http=http://1.1.1.1;" 150 "http=1.1.1.1:80;" // http:// is pruned.
151 "https=socks://2.2.2.2;" 151 "https=socks5://2.2.2.2:1080;" // socks5 equals socks.
152 "ftp=http://3.3.3.3:9000;" 152 "ftp=3.3.3.3:9000;" // http:// is pruned.
153 "socks=socks4://4.4.4.4:9090", 153 "socks=socks4://4.4.4.4:9090",
154 kNoPac, 154 kNoPac,
155 pref_service); 155 pref_service);
156 156
157 // Now check the incognito preferences. 157 // Now check the incognito preferences.
158 pref_service = browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); 158 pref_service = browser()->profile()->GetOffTheRecordProfile()->GetPrefs();
159 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS, 159 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS,
160 "http=http://1.1.1.1;" 160 "http=1.1.1.1:80;"
161 "https=socks://2.2.2.2;" 161 "https=socks5://2.2.2.2:1080;"
162 "ftp=http://3.3.3.3:9000;" 162 "ftp=3.3.3.3:9000;"
163 "socks=socks4://4.4.4.4:9090", 163 "socks=socks4://4.4.4.4:9090",
164 kNoPac, 164 kNoPac,
165 pref_service); 165 pref_service);
166 } 166 }
167 167
168 // Tests setting values only for incognito mode 168 // Tests setting values only for incognito mode
169 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, 169 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest,
170 ProxyFixedIndividualIncognitoOnly) { 170 ProxyFixedIndividualIncognitoOnly) {
171 CommandLine::ForCurrentProcess()->AppendSwitch( 171 CommandLine::ForCurrentProcess()->AppendSwitch(
172 switches::kEnableExperimentalExtensionApis); 172 switches::kEnableExperimentalExtensionApis);
173 173
174 ASSERT_TRUE(RunExtensionTest("proxy/individual_incognito_only")) << message_; 174 ASSERT_TRUE(RunExtensionTest("proxy/individual_incognito_only")) << message_;
175 const Extension* extension = GetSingleLoadedExtension(); 175 const Extension* extension = GetSingleLoadedExtension();
176 ASSERT_TRUE(extension); 176 ASSERT_TRUE(extension);
177 177
178 PrefService* pref_service = browser()->profile()->GetPrefs(); 178 PrefService* pref_service = browser()->profile()->GetPrefs();
179 ExpectNoSettings(pref_service); 179 ExpectNoSettings(pref_service);
180 180
181 // Now check the incognito preferences. 181 // Now check the incognito preferences.
182 pref_service = browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); 182 pref_service = browser()->profile()->GetOffTheRecordProfile()->GetPrefs();
183 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS, 183 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS,
184 "http=http://1.1.1.1;" 184 "http=1.1.1.1:80;"
185 "https=socks://2.2.2.2;" 185 "https=socks5://2.2.2.2:1080;"
186 "ftp=http://3.3.3.3:9000;" 186 "ftp=3.3.3.3:9000;"
187 "socks=socks4://4.4.4.4:9090", 187 "socks=socks4://4.4.4.4:9090",
188 kNoPac, 188 kNoPac,
189 pref_service); 189 pref_service);
190 } 190 }
191 191
192 // Tests setting values also for incognito mode 192 // Tests setting values also for incognito mode
193 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, 193 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest,
194 ProxyFixedIndividualIncognitoAlso) { 194 ProxyFixedIndividualIncognitoAlso) {
195 CommandLine::ForCurrentProcess()->AppendSwitch( 195 CommandLine::ForCurrentProcess()->AppendSwitch(
196 switches::kEnableExperimentalExtensionApis); 196 switches::kEnableExperimentalExtensionApis);
197 197
198 ASSERT_TRUE(RunExtensionTest("proxy/individual_incognito_also")) << message_; 198 ASSERT_TRUE(RunExtensionTest("proxy/individual_incognito_also")) << message_;
199 const Extension* extension = GetSingleLoadedExtension(); 199 const Extension* extension = GetSingleLoadedExtension();
200 ASSERT_TRUE(extension); 200 ASSERT_TRUE(extension);
201 201
202 PrefService* pref_service = browser()->profile()->GetPrefs(); 202 PrefService* pref_service = browser()->profile()->GetPrefs();
203 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS, 203 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS,
204 "http=http://1.1.1.1;" 204 "http=1.1.1.1:80;"
205 "https=socks://2.2.2.2;" 205 "https=socks5://2.2.2.2:1080;"
206 "ftp=http://3.3.3.3:9000;" 206 "ftp=3.3.3.3:9000;"
207 "socks=socks4://4.4.4.4:9090", 207 "socks=socks4://4.4.4.4:9090",
208 kNoPac, 208 kNoPac,
209 pref_service); 209 pref_service);
210 210
211 // Now check the incognito preferences. 211 // Now check the incognito preferences.
212 pref_service = browser()->profile()->GetOffTheRecordProfile()->GetPrefs(); 212 pref_service = browser()->profile()->GetOffTheRecordProfile()->GetPrefs();
213 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS, 213 ValidateSettings(ProxyPrefs::MODE_FIXED_SERVERS,
214 "http=http://5.5.5.5;" 214 "http=5.5.5.5:80;"
215 "https=socks://6.6.6.6;" 215 "https=socks5://6.6.6.6:1080;"
216 "ftp=http://7.7.7.7:9000;" 216 "ftp=7.7.7.7:9000;"
217 "socks=socks4://8.8.8.8:9090", 217 "socks=socks4://8.8.8.8:9090",
218 kNoPac, 218 kNoPac,
219 pref_service); 219 pref_service);
220 } 220 }
221 221
222 // Tests setting and unsetting values 222 // Tests setting and unsetting values
223 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividualRemove) { 223 IN_PROC_BROWSER_TEST_F(ProxySettingsApiTest, ProxyFixedIndividualRemove) {
224 CommandLine::ForCurrentProcess()->AppendSwitch( 224 CommandLine::ForCurrentProcess()->AppendSwitch(
225 switches::kEnableExperimentalExtensionApis); 225 switches::kEnableExperimentalExtensionApis);
226 226
227 ASSERT_TRUE(RunExtensionTest("proxy/individual_remove")) << message_; 227 ASSERT_TRUE(RunExtensionTest("proxy/individual_remove")) << message_;
228 const Extension* extension = GetSingleLoadedExtension(); 228 const Extension* extension = GetSingleLoadedExtension();
229 ASSERT_TRUE(extension); 229 ASSERT_TRUE(extension);
230 230
231 PrefService* pref_service = browser()->profile()->GetPrefs(); 231 PrefService* pref_service = browser()->profile()->GetPrefs();
232 ExpectNoSettings(pref_service); 232 ExpectNoSettings(pref_service);
233 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698