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 "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "net/test/test_server.h" | 12 #include "net/test/test_server.h" |
13 | 13 |
14 class HostRulesTest : public InProcessBrowserTest { | 14 class HostRulesTest : public InProcessBrowserTest { |
15 protected: | 15 protected: |
16 HostRulesTest() { | 16 HostRulesTest() {} |
17 EnableDOMAutomation(); | |
18 } | |
19 | 17 |
20 virtual void SetUpCommandLine(CommandLine* command_line) { | 18 virtual void SetUpCommandLine(CommandLine* command_line) { |
21 ASSERT_TRUE(test_server()->Start()); | 19 ASSERT_TRUE(test_server()->Start()); |
22 | 20 |
23 // Map all hosts to our local server. | 21 // Map all hosts to our local server. |
24 std::string host_rule( | 22 std::string host_rule( |
25 "MAP * " + test_server()->host_port_pair().ToString()); | 23 "MAP * " + test_server()->host_port_pair().ToString()); |
26 command_line->AppendSwitchASCII(switches::kHostRules, host_rule); | 24 command_line->AppendSwitchASCII(switches::kHostRules, host_rule); |
27 // Use no proxy or otherwise this test will fail on a machine that has a | 25 // Use no proxy or otherwise this test will fail on a machine that has a |
28 // proxy configured. | 26 // proxy configured. |
(...skipping 12 matching lines...) Expand all Loading... |
41 | 39 |
42 std::string html; | 40 std::string html; |
43 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 41 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
44 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 42 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
45 L"", | 43 L"", |
46 L"window.domAutomationController.send(document.body.outerHTML);", | 44 L"window.domAutomationController.send(document.body.outerHTML);", |
47 &html)); | 45 &html)); |
48 | 46 |
49 EXPECT_STREQ("<body></body>", html.c_str()); | 47 EXPECT_STREQ("<body></body>", html.c_str()); |
50 } | 48 } |
OLD | NEW |