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 "chrome/common/chrome_switches.h" | 5 #include "chrome/common/chrome_switches.h" |
6 #include "chrome/test/automation/automation_proxy.h" | 6 #include "chrome/test/automation/automation_proxy.h" |
7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
9 #include "chrome/test/ui/ui_test.h" | 9 #include "chrome/test/ui/ui_test.h" |
10 #include "net/test/test_server.h" | 10 #include "net/test/test_server.h" |
11 | 11 |
12 class HostRulesTest : public UITest { | 12 class HostRulesTest : public UITest { |
13 protected: | 13 protected: |
14 HostRulesTest(); | 14 HostRulesTest(); |
15 | 15 |
16 net::TestServer test_server_; | 16 net::TestServer test_server_; |
17 bool test_server_started_; | 17 bool test_server_started_; |
18 | 18 |
19 private: | 19 private: |
20 DISALLOW_COPY_AND_ASSIGN(HostRulesTest); | 20 DISALLOW_COPY_AND_ASSIGN(HostRulesTest); |
21 }; | 21 }; |
22 | 22 |
23 HostRulesTest::HostRulesTest() | 23 HostRulesTest::HostRulesTest() |
24 : test_server_(net::TestServer::TYPE_HTTP, | 24 : test_server_(net::TestServer::TYPE_HTTP, |
| 25 net::TestServer::kLocalhost, |
25 FilePath(FILE_PATH_LITERAL("chrome/test/data"))), | 26 FilePath(FILE_PATH_LITERAL("chrome/test/data"))), |
26 test_server_started_(false) { | 27 test_server_started_(false) { |
27 dom_automation_enabled_ = true; | 28 dom_automation_enabled_ = true; |
28 | 29 |
29 // The test_server is started in the constructor (rather than the test body) | 30 // The test_server is started in the constructor (rather than the test body) |
30 // so the mapping rules below can include the ephemeral port number. | 31 // so the mapping rules below can include the ephemeral port number. |
31 // TODO(phajdan.jr): Change this code when we can ask the test server whether | 32 // TODO(phajdan.jr): Change this code when we can ask the test server whether |
32 // it started. | 33 // it started. |
33 test_server_started_ = test_server_.Start(); | 34 test_server_started_ = test_server_.Start(); |
34 if (!test_server_started_) | 35 if (!test_server_started_) |
(...skipping 19 matching lines...) Expand all Loading... |
54 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); | 55 EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); |
55 | 56 |
56 std::wstring html; | 57 std::wstring html; |
57 EXPECT_TRUE(tab->ExecuteAndExtractString( | 58 EXPECT_TRUE(tab->ExecuteAndExtractString( |
58 L"", | 59 L"", |
59 L"window.domAutomationController.send(document.body.outerHTML);", | 60 L"window.domAutomationController.send(document.body.outerHTML);", |
60 &html)); | 61 &html)); |
61 | 62 |
62 EXPECT_STREQ(L"<body></body>", html.c_str()); | 63 EXPECT_STREQ(L"<body></body>", html.c_str()); |
63 } | 64 } |
OLD | NEW |