OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 5 #include "base/string_util.h" |
6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/automation/automation_proxy.h" | 10 #include "chrome/test/automation/automation_proxy.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 net::TestServer test_server_; | 30 net::TestServer test_server_; |
31 GURL search_provider_test_url_; | 31 GURL search_provider_test_url_; |
32 bool test_server_started_; | 32 bool test_server_started_; |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); | 35 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); |
36 }; | 36 }; |
37 | 37 |
38 SearchProviderTest::SearchProviderTest() | 38 SearchProviderTest::SearchProviderTest() |
39 : test_server_(net::TestServer::TYPE_HTTP, | 39 : test_server_(net::TestServer::TYPE_HTTP, |
| 40 net::TestServer::kLocalhost, |
40 FilePath(FILE_PATH_LITERAL("chrome/test/data"))), | 41 FilePath(FILE_PATH_LITERAL("chrome/test/data"))), |
41 test_server_started_(false) { | 42 test_server_started_(false) { |
42 // The test_server is started in the constructor (rather than the test body) | 43 // The test_server is started in the constructor (rather than the test body) |
43 // so the mapping rules below can include the ephemeral port number. | 44 // so the mapping rules below can include the ephemeral port number. |
44 test_server_started_ = test_server_.Start(); | 45 test_server_started_ = test_server_.Start(); |
45 if (!test_server_started_) | 46 if (!test_server_started_) |
46 return; | 47 return; |
47 | 48 |
48 // Map all hosts to our local server. | 49 // Map all hosts to our local server. |
49 std::string host_rule("MAP * " + test_server_.host_port_pair().ToString()); | 50 std::string host_rule("MAP * " + test_server_.host_port_pair().ToString()); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 TEST_F(SearchProviderTest, TestIsSearchProviderInstalledWithException) { | 184 TEST_F(SearchProviderTest, TestIsSearchProviderInstalledWithException) { |
184 // Change the url for the test page to one that throws an exception when | 185 // Change the url for the test page to one that throws an exception when |
185 // toString is called on the argument given to isSearchProviderInstalled. | 186 // toString is called on the argument given to isSearchProviderInstalled. |
186 search_provider_test_url_ = test_server_.GetURL( | 187 search_provider_test_url_ = test_server_.GetURL( |
187 "files/is_search_provider_installed_with_exception.html"); | 188 "files/is_search_provider_installed_with_exception.html"); |
188 | 189 |
189 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 190 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
190 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( | 191 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( |
191 browser, "www.google.com", "")); | 192 browser, "www.google.com", "")); |
192 } | 193 } |
OLD | NEW |