OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 NotificationService::AllSources()); | 124 NotificationService::AllSources()); |
125 ui_test_utils::RunMessageLoop(); | 125 ui_test_utils::RunMessageLoop(); |
126 registrar_.Remove(this, NotificationType::USER_SCRIPTS_UPDATED, | 126 registrar_.Remove(this, NotificationType::USER_SCRIPTS_UPDATED, |
127 NotificationService::AllSources()); | 127 NotificationService::AllSources()); |
128 } | 128 } |
129 ASSERT_TRUE(master->ScriptsReady()); | 129 ASSERT_TRUE(master->ScriptsReady()); |
130 } | 130 } |
131 | 131 |
132 void TestInjection(bool expect_css, bool expect_script) { | 132 void TestInjection(bool expect_css, bool expect_script) { |
133 // Load a page affected by the content script and test to see the effect. | 133 // Load a page affected by the content script and test to see the effect. |
134 HTTPTestServer* server = StartHTTPServer(); | 134 FilePath test_file; |
135 GURL url = server->TestServerPage("file/extensions/test_file.html"); | 135 PathService::Get(chrome::DIR_TEST_DATA, &test_file); |
136 ui_test_utils::NavigateToURL(browser(), url); | 136 test_file = test_file.AppendASCII("extensions") |
| 137 .AppendASCII("test_file.html"); |
| 138 |
| 139 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file)); |
137 | 140 |
138 bool result = false; | 141 bool result = false; |
139 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 142 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
140 browser()->GetSelectedTabContents()->render_view_host(), L"", | 143 browser()->GetSelectedTabContents()->render_view_host(), L"", |
141 L"window.domAutomationController.send(" | 144 L"window.domAutomationController.send(" |
142 L"document.defaultView.getComputedStyle(document.body, null)." | 145 L"document.defaultView.getComputedStyle(document.body, null)." |
143 L"getPropertyValue('background-color') == 'rgb(245, 245, 220)')", | 146 L"getPropertyValue('background-color') == 'rgb(245, 245, 220)')", |
144 &result); | 147 &result); |
145 EXPECT_EQ(expect_css, result); | 148 EXPECT_EQ(expect_css, result); |
146 | 149 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 228 |
226 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); | 229 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); |
227 | 230 |
228 bool result = false; | 231 bool result = false; |
229 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 232 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
230 browser()->GetSelectedTabContents()->render_view_host(), L"", | 233 browser()->GetSelectedTabContents()->render_view_host(), L"", |
231 L"window.domAutomationController.send(document.title == 'Modified')", | 234 L"window.domAutomationController.send(document.title == 'Modified')", |
232 &result); | 235 &result); |
233 EXPECT_FALSE(result); | 236 EXPECT_FALSE(result); |
234 } | 237 } |
OLD | NEW |