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

Side by Side Diff: chrome/browser/net/proxy_browsertest.cc

Issue 816403003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 : proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY, 78 : proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY,
79 net::SpawnedTestServer::kLocalhost, 79 net::SpawnedTestServer::kLocalhost,
80 base::FilePath()) { 80 base::FilePath()) {
81 } 81 }
82 82
83 void SetUp() override { 83 void SetUp() override {
84 ASSERT_TRUE(proxy_server_.Start()); 84 ASSERT_TRUE(proxy_server_.Start());
85 InProcessBrowserTest::SetUp(); 85 InProcessBrowserTest::SetUp();
86 } 86 }
87 87
88 void SetUpCommandLine(CommandLine* command_line) override { 88 void SetUpCommandLine(base::CommandLine* command_line) override {
89 command_line->AppendSwitchASCII(switches::kProxyServer, 89 command_line->AppendSwitchASCII(switches::kProxyServer,
90 proxy_server_.host_port_pair().ToString()); 90 proxy_server_.host_port_pair().ToString());
91 } 91 }
92 92
93 protected: 93 protected:
94 net::SpawnedTestServer proxy_server_; 94 net::SpawnedTestServer proxy_server_;
95 95
96 private: 96 private:
97 97
98 DISALLOW_COPY_AND_ASSIGN(ProxyBrowserTest); 98 DISALLOW_COPY_AND_ASSIGN(ProxyBrowserTest);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 net::SpawnedTestServer::kLocalhost, 148 net::SpawnedTestServer::kLocalhost,
149 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { 149 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
150 } 150 }
151 ~HttpProxyScriptBrowserTest() override {} 151 ~HttpProxyScriptBrowserTest() override {}
152 152
153 void SetUp() override { 153 void SetUp() override {
154 ASSERT_TRUE(http_server_.Start()); 154 ASSERT_TRUE(http_server_.Start());
155 InProcessBrowserTest::SetUp(); 155 InProcessBrowserTest::SetUp();
156 } 156 }
157 157
158 void SetUpCommandLine(CommandLine* command_line) override { 158 void SetUpCommandLine(base::CommandLine* command_line) override {
159 base::FilePath pac_script_path(FILE_PATH_LITERAL("files")); 159 base::FilePath pac_script_path(FILE_PATH_LITERAL("files"));
160 command_line->AppendSwitchASCII(switches::kProxyPacUrl, http_server_.GetURL( 160 command_line->AppendSwitchASCII(switches::kProxyPacUrl, http_server_.GetURL(
161 pac_script_path.Append(kPACScript).MaybeAsASCII()).spec()); 161 pac_script_path.Append(kPACScript).MaybeAsASCII()).spec());
162 } 162 }
163 163
164 private: 164 private:
165 net::SpawnedTestServer http_server_; 165 net::SpawnedTestServer http_server_;
166 166
167 DISALLOW_COPY_AND_ASSIGN(HttpProxyScriptBrowserTest); 167 DISALLOW_COPY_AND_ASSIGN(HttpProxyScriptBrowserTest);
168 }; 168 };
169 169
170 IN_PROC_BROWSER_TEST_F(HttpProxyScriptBrowserTest, Verify) { 170 IN_PROC_BROWSER_TEST_F(HttpProxyScriptBrowserTest, Verify) {
171 VerifyProxyScript(browser()); 171 VerifyProxyScript(browser());
172 } 172 }
173 173
174 // Fetch PAC script via a file:// URL. 174 // Fetch PAC script via a file:// URL.
175 class FileProxyScriptBrowserTest : public InProcessBrowserTest { 175 class FileProxyScriptBrowserTest : public InProcessBrowserTest {
176 public: 176 public:
177 FileProxyScriptBrowserTest() {} 177 FileProxyScriptBrowserTest() {}
178 ~FileProxyScriptBrowserTest() override {} 178 ~FileProxyScriptBrowserTest() override {}
179 179
180 void SetUpCommandLine(CommandLine* command_line) override { 180 void SetUpCommandLine(base::CommandLine* command_line) override {
181 command_line->AppendSwitchASCII(switches::kProxyPacUrl, 181 command_line->AppendSwitchASCII(switches::kProxyPacUrl,
182 ui_test_utils::GetTestUrl( 182 ui_test_utils::GetTestUrl(
183 base::FilePath(base::FilePath::kCurrentDirectory), 183 base::FilePath(base::FilePath::kCurrentDirectory),
184 base::FilePath(kPACScript)).spec()); 184 base::FilePath(kPACScript)).spec());
185 } 185 }
186 186
187 private: 187 private:
188 DISALLOW_COPY_AND_ASSIGN(FileProxyScriptBrowserTest); 188 DISALLOW_COPY_AND_ASSIGN(FileProxyScriptBrowserTest);
189 }; 189 };
190 190
191 IN_PROC_BROWSER_TEST_F(FileProxyScriptBrowserTest, Verify) { 191 IN_PROC_BROWSER_TEST_F(FileProxyScriptBrowserTest, Verify) {
192 VerifyProxyScript(browser()); 192 VerifyProxyScript(browser());
193 } 193 }
194 194
195 // Fetch PAC script via an ftp:// URL. 195 // Fetch PAC script via an ftp:// URL.
196 class FtpProxyScriptBrowserTest : public InProcessBrowserTest { 196 class FtpProxyScriptBrowserTest : public InProcessBrowserTest {
197 public: 197 public:
198 FtpProxyScriptBrowserTest() 198 FtpProxyScriptBrowserTest()
199 : ftp_server_(net::SpawnedTestServer::TYPE_FTP, 199 : ftp_server_(net::SpawnedTestServer::TYPE_FTP,
200 net::SpawnedTestServer::kLocalhost, 200 net::SpawnedTestServer::kLocalhost,
201 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { 201 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
202 } 202 }
203 ~FtpProxyScriptBrowserTest() override {} 203 ~FtpProxyScriptBrowserTest() override {}
204 204
205 void SetUp() override { 205 void SetUp() override {
206 ASSERT_TRUE(ftp_server_.Start()); 206 ASSERT_TRUE(ftp_server_.Start());
207 InProcessBrowserTest::SetUp(); 207 InProcessBrowserTest::SetUp();
208 } 208 }
209 209
210 void SetUpCommandLine(CommandLine* command_line) override { 210 void SetUpCommandLine(base::CommandLine* command_line) override {
211 base::FilePath pac_script_path(kPACScript); 211 base::FilePath pac_script_path(kPACScript);
212 command_line->AppendSwitchASCII( 212 command_line->AppendSwitchASCII(
213 switches::kProxyPacUrl, 213 switches::kProxyPacUrl,
214 ftp_server_.GetURL(pac_script_path.MaybeAsASCII()).spec()); 214 ftp_server_.GetURL(pac_script_path.MaybeAsASCII()).spec());
215 } 215 }
216 216
217 private: 217 private:
218 net::SpawnedTestServer ftp_server_; 218 net::SpawnedTestServer ftp_server_;
219 219
220 DISALLOW_COPY_AND_ASSIGN(FtpProxyScriptBrowserTest); 220 DISALLOW_COPY_AND_ASSIGN(FtpProxyScriptBrowserTest);
221 }; 221 };
222 222
223 IN_PROC_BROWSER_TEST_F(FtpProxyScriptBrowserTest, Verify) { 223 IN_PROC_BROWSER_TEST_F(FtpProxyScriptBrowserTest, Verify) {
224 VerifyProxyScript(browser()); 224 VerifyProxyScript(browser());
225 } 225 }
226 226
227 // Fetch PAC script via a data: URL. 227 // Fetch PAC script via a data: URL.
228 class DataProxyScriptBrowserTest : public InProcessBrowserTest { 228 class DataProxyScriptBrowserTest : public InProcessBrowserTest {
229 public: 229 public:
230 DataProxyScriptBrowserTest() {} 230 DataProxyScriptBrowserTest() {}
231 ~DataProxyScriptBrowserTest() override {} 231 ~DataProxyScriptBrowserTest() override {}
232 232
233 void SetUpCommandLine(CommandLine* command_line) override { 233 void SetUpCommandLine(base::CommandLine* command_line) override {
234 std::string contents; 234 std::string contents;
235 // Read in kPACScript contents. 235 // Read in kPACScript contents.
236 ASSERT_TRUE(base::ReadFileToString(ui_test_utils::GetTestFilePath( 236 ASSERT_TRUE(base::ReadFileToString(ui_test_utils::GetTestFilePath(
237 base::FilePath(base::FilePath::kCurrentDirectory), 237 base::FilePath(base::FilePath::kCurrentDirectory),
238 base::FilePath(kPACScript)), 238 base::FilePath(kPACScript)),
239 &contents)); 239 &contents));
240 command_line->AppendSwitchASCII(switches::kProxyPacUrl, 240 command_line->AppendSwitchASCII(switches::kProxyPacUrl,
241 std::string("data:,") + contents); 241 std::string("data:,") + contents);
242 } 242 }
243 243
244 private: 244 private:
245 DISALLOW_COPY_AND_ASSIGN(DataProxyScriptBrowserTest); 245 DISALLOW_COPY_AND_ASSIGN(DataProxyScriptBrowserTest);
246 }; 246 };
247 247
248 IN_PROC_BROWSER_TEST_F(DataProxyScriptBrowserTest, Verify) { 248 IN_PROC_BROWSER_TEST_F(DataProxyScriptBrowserTest, Verify) {
249 VerifyProxyScript(browser()); 249 VerifyProxyScript(browser());
250 } 250 }
251 251
252 } // namespace 252 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/net/pref_proxy_config_tracker_impl_unittest.cc ('k') | chrome/browser/net/proxy_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698