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 27 matching lines...) Expand all Loading... |
38 SearchProviderTest::SearchProviderTest() | 38 SearchProviderTest::SearchProviderTest() |
39 : test_server_(net::TestServer::TYPE_HTTP, | 39 : test_server_(net::TestServer::TYPE_HTTP, |
40 FilePath(FILE_PATH_LITERAL("chrome/test/data"))), | 40 FilePath(FILE_PATH_LITERAL("chrome/test/data"))), |
41 test_server_started_(false) { | 41 test_server_started_(false) { |
42 // The test_server is started in the constructor (rather than the test body) | 42 // 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. | 43 // so the mapping rules below can include the ephemeral port number. |
44 test_server_started_ = test_server_.Start(); | 44 test_server_started_ = test_server_.Start(); |
45 if (!test_server_started_) | 45 if (!test_server_started_) |
46 return; | 46 return; |
47 | 47 |
48 // Enable the search provider additions. | |
49 launch_arguments_.AppendSwitch(switches::kEnableSearchProviderApiV2); | |
50 | |
51 // Map all hosts to our local server. | 48 // Map all hosts to our local server. |
52 std::string host_rule("MAP * " + test_server_.host_port_pair().ToString()); | 49 std::string host_rule("MAP * " + test_server_.host_port_pair().ToString()); |
53 launch_arguments_.AppendSwitchASCII(switches::kHostRules, host_rule); | 50 launch_arguments_.AppendSwitchASCII(switches::kHostRules, host_rule); |
54 | 51 |
55 // Get the url for the test page. | 52 // Get the url for the test page. |
56 search_provider_test_url_ = | 53 search_provider_test_url_ = |
57 test_server_.GetURL("files/is_search_provider_installed.html"); | 54 test_server_.GetURL("files/is_search_provider_installed.html"); |
58 } | 55 } |
59 | 56 |
60 struct IsSearchProviderTestData { | 57 struct IsSearchProviderTestData { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 TEST_F(SearchProviderTest, TestIsSearchProviderInstalledWithException) { | 183 TEST_F(SearchProviderTest, TestIsSearchProviderInstalledWithException) { |
187 // Change the url for the test page to one that throws an exception when | 184 // Change the url for the test page to one that throws an exception when |
188 // toString is called on the argument given to isSearchProviderInstalled. | 185 // toString is called on the argument given to isSearchProviderInstalled. |
189 search_provider_test_url_ = test_server_.GetURL( | 186 search_provider_test_url_ = test_server_.GetURL( |
190 "files/is_search_provider_installed_with_exception.html"); | 187 "files/is_search_provider_installed_with_exception.html"); |
191 | 188 |
192 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 189 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
193 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( | 190 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( |
194 browser, "www.google.com", "")); | 191 browser, "www.google.com", "")); |
195 } | 192 } |
OLD | NEW |