OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "chrome/app/chrome_dll_resource.h" | 6 #include "chrome/app/chrome_dll_resource.h" |
7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
9 #include "chrome/test/ui/ui_layout_test.h" | 9 #include "chrome/test/ui/ui_layout_test.h" |
10 #include "chrome/test/ui_test_utils.h" | 10 #include "chrome/test/ui_test_utils.h" |
11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
12 #include "net/url_request/url_request_unittest.h" | 12 #include "net/test/test_server.h" |
13 | 13 |
14 class SearchProviderTest : public UITest { | 14 class SearchProviderTest : public UITest { |
15 protected: | 15 protected: |
16 SearchProviderTest(); | 16 SearchProviderTest(); |
17 virtual ~SearchProviderTest(); | 17 virtual ~SearchProviderTest(); |
18 | 18 |
19 void TestIsSearchProviderInstalledForHost( | 19 void TestIsSearchProviderInstalledForHost( |
20 TabProxy* tab, | 20 TabProxy* tab, |
21 const char* host, | 21 const char* host, |
22 const char* expected_result); | 22 const char* expected_result); |
23 | 23 |
24 scoped_refptr<HTTPTestServer> server_; | 24 scoped_refptr<net::HTTPTestServer> server_; |
25 | 25 |
26 private: | 26 private: |
27 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); | 27 DISALLOW_COPY_AND_ASSIGN(SearchProviderTest); |
28 }; | 28 }; |
29 | 29 |
30 SearchProviderTest::SearchProviderTest() | 30 SearchProviderTest::SearchProviderTest() |
31 : server_(HTTPTestServer::CreateServer(L"chrome/test/data")) { | 31 : server_(net::HTTPTestServer::CreateServer(L"chrome/test/data")) { |
32 if (!server_) | 32 if (!server_) |
33 return; | 33 return; |
34 | 34 |
35 // Enable the search provider additions. | 35 // Enable the search provider additions. |
36 launch_arguments_.AppendSwitch(switches::kEnableSearchProviderApiV2); | 36 launch_arguments_.AppendSwitch(switches::kEnableSearchProviderApiV2); |
37 | 37 |
38 // Map all hosts to our local server. | 38 // Map all hosts to our local server. |
39 GURL server_url = server_->TestServerPage(""); | 39 GURL server_url = server_->TestServerPage(""); |
40 std::string host_rule = "MAP * "; | 40 std::string host_rule = "MAP * "; |
41 host_rule.append(server_url.host()); | 41 host_rule.append(server_url.host()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ASSERT_TRUE(browser.get()); | 89 ASSERT_TRUE(browser.get()); |
90 ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); | 90 ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); |
91 scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1)); | 91 scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1)); |
92 ASSERT_TRUE(incognito.get()); | 92 ASSERT_TRUE(incognito.get()); |
93 scoped_refptr<TabProxy> incognito_tab(incognito->GetTab(0)); | 93 scoped_refptr<TabProxy> incognito_tab(incognito->GetTab(0)); |
94 ASSERT_TRUE(incognito_tab.get()); | 94 ASSERT_TRUE(incognito_tab.get()); |
95 TestIsSearchProviderInstalledForHost(incognito_tab, "www.google.com", "0"); | 95 TestIsSearchProviderInstalledForHost(incognito_tab, "www.google.com", "0"); |
96 TestIsSearchProviderInstalledForHost(incognito_tab, "www.bing.com", "0"); | 96 TestIsSearchProviderInstalledForHost(incognito_tab, "www.bing.com", "0"); |
97 TestIsSearchProviderInstalledForHost(incognito_tab, "localhost", "0"); | 97 TestIsSearchProviderInstalledForHost(incognito_tab, "localhost", "0"); |
98 } | 98 } |
OLD | NEW |