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/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 IsSearchProviderTestData StartIsSearchProviderInstalledTest( | 53 IsSearchProviderTestData StartIsSearchProviderInstalledTest( |
54 Browser* browser, | 54 Browser* browser, |
55 const char* host, | 55 const char* host, |
56 const char* expected_result) { | 56 const char* expected_result) { |
57 GURL test_url(std::string("http://") + host + | 57 GURL test_url(std::string("http://") + host + |
58 search_provider_test_url_.path() + "#" + expected_result); | 58 search_provider_test_url_.path() + "#" + expected_result); |
59 ui_test_utils::NavigateToURLWithDisposition( | 59 ui_test_utils::NavigateToURLWithDisposition( |
60 browser, test_url, NEW_FOREGROUND_TAB, | 60 browser, test_url, NEW_FOREGROUND_TAB, |
61 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 61 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
62 | 62 |
63 // Bundle up information needed to verify the result. | 63 // Bundle up information needed to verify the result. |
64 content::WebContents* tab = | 64 content::WebContents* tab = |
65 browser->tab_strip_model()->GetActiveWebContents(); | 65 browser->tab_strip_model()->GetActiveWebContents(); |
66 return IsSearchProviderTestData(tab, host, test_url); | 66 return IsSearchProviderTestData(tab, host, test_url); |
67 } | 67 } |
68 | 68 |
69 void FinishIsSearchProviderInstalledTest( | 69 void FinishIsSearchProviderInstalledTest( |
70 const IsSearchProviderTestData& data) { | 70 const IsSearchProviderTestData& data) { |
71 string16 title = data.tab->GetTitle(); | 71 string16 title = data.tab->GetTitle(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 IN_PROC_BROWSER_TEST_F(SearchProviderTest, | 137 IN_PROC_BROWSER_TEST_F(SearchProviderTest, |
138 TestIsSearchProviderInstalledWithException) { | 138 TestIsSearchProviderInstalledWithException) { |
139 // Change the url for the test page to one that throws an exception when | 139 // Change the url for the test page to one that throws an exception when |
140 // toString is called on the argument given to isSearchProviderInstalled. | 140 // toString is called on the argument given to isSearchProviderInstalled. |
141 search_provider_test_url_ = test_server()->GetURL( | 141 search_provider_test_url_ = test_server()->GetURL( |
142 "files/is_search_provider_installed_with_exception.html"); | 142 "files/is_search_provider_installed_with_exception.html"); |
143 | 143 |
144 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( | 144 FinishIsSearchProviderInstalledTest(StartIsSearchProviderInstalledTest( |
145 browser(), "www.google.com", "")); | 145 browser(), "www.google.com", "")); |
146 } | 146 } |
OLD | NEW |