| OLD | NEW |
| 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/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Use the default search provider, other installed search provider, and | 99 // Use the default search provider, other installed search provider, and |
| 100 // one not installed as well. (Note that yahoo isn't tested because the | 100 // one not installed as well. (Note that yahoo isn't tested because the |
| 101 // its host name varies a lot for different locales unlike Google and Bing, | 101 // its host name varies a lot for different locales unlike Google and Bing, |
| 102 // which would make the test fail depending on the machine's locale.) | 102 // which would make the test fail depending on the machine's locale.) |
| 103 const char* test_hosts[] = { "www.google.com", | 103 const char* test_hosts[] = { "www.google.com", |
| 104 "www.bing.com", | 104 "www.bing.com", |
| 105 "localhost" }; | 105 "localhost" }; |
| 106 const char* expected_results[] = { "2", | 106 const char* expected_results[] = { "2", |
| 107 "1", | 107 "1", |
| 108 "0" }; | 108 "0" }; |
| 109 COMPILE_ASSERT(arraysize(test_hosts) == arraysize(expected_results), | 109 static_assert(arraysize(test_hosts) == arraysize(expected_results), |
| 110 there_should_be_a_result_for_each_host); | 110 "each host should have a test result"); |
| 111 IsSearchProviderTestData test_data[2 * arraysize(test_hosts)]; | 111 IsSearchProviderTestData test_data[2 * arraysize(test_hosts)]; |
| 112 | 112 |
| 113 // Start results for the normal mode. | 113 // Start results for the normal mode. |
| 114 for (size_t i = 0; i < arraysize(test_hosts); ++i) { | 114 for (size_t i = 0; i < arraysize(test_hosts); ++i) { |
| 115 test_data[i] = StartIsSearchProviderInstalledTest( | 115 test_data[i] = StartIsSearchProviderInstalledTest( |
| 116 browser(), test_hosts[i], expected_results[i]); | 116 browser(), test_hosts[i], expected_results[i]); |
| 117 FinishIsSearchProviderInstalledTest(test_data[i]); | 117 FinishIsSearchProviderInstalledTest(test_data[i]); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Start tests for incognito mode (and verify the result is 0). | 120 // Start tests for incognito mode (and verify the result is 0). |
| (...skipping 20 matching lines...) Expand all Loading... |
| 141 IN_PROC_BROWSER_TEST_F(SearchProviderTest, | 141 IN_PROC_BROWSER_TEST_F(SearchProviderTest, |
| 142 TestIsSearchProviderInstalledWithException) { | 142 TestIsSearchProviderInstalledWithException) { |
| 143 // Change the url for the test page to one that throws an exception when | 143 // Change the url for the test page to one that throws an exception when |
| 144 // toString is called on the argument given to isSearchProviderInstalled. | 144 // toString is called on the argument given to isSearchProviderInstalled. |
| 145 search_provider_test_url_ = test_server()->GetURL( | 145 search_provider_test_url_ = test_server()->GetURL( |
| 146 "files/is_search_provider_installed_with_exception.html"); | 146 "files/is_search_provider_installed_with_exception.html"); |
| 147 | 147 |
| 148 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( | 148 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( |
| 149 browser(), "www.google.com", "")); | 149 browser(), "www.google.com", "")); |
| 150 } | 150 } |
| OLD | NEW |