| 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 <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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Load a page affected by the content script and test to see the effect. | 120 // Load a page affected by the content script and test to see the effect. |
| 121 FilePath test_file; | 121 FilePath test_file; |
| 122 PathService::Get(chrome::DIR_TEST_DATA, &test_file); | 122 PathService::Get(chrome::DIR_TEST_DATA, &test_file); |
| 123 test_file = test_file.AppendASCII("extensions") | 123 test_file = test_file.AppendASCII("extensions") |
| 124 .AppendASCII("test_file.html"); | 124 .AppendASCII("test_file.html"); |
| 125 | 125 |
| 126 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file)); | 126 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_file)); |
| 127 | 127 |
| 128 bool result = false; | 128 bool result = false; |
| 129 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 129 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
| 130 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 130 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
| 131 "", | 131 L"window.domAutomationController.send(" |
| 132 "window.domAutomationController.send(" | 132 L"document.defaultView.getComputedStyle(document.body, null)." |
| 133 "document.defaultView.getComputedStyle(document.body, null)." | 133 L"getPropertyValue('background-color') == 'rgb(245, 245, 220)')", |
| 134 "getPropertyValue('background-color') == 'rgb(245, 245, 220)')", | |
| 135 &result)); | 134 &result)); |
| 136 EXPECT_EQ(expect_css, result); | 135 EXPECT_EQ(expect_css, result); |
| 137 | 136 |
| 138 result = false; | 137 result = false; |
| 139 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 138 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
| 140 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 139 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
| 141 "", | 140 L"window.domAutomationController.send(document.title == 'Modified')", |
| 142 "window.domAutomationController.send(document.title == 'Modified')", | |
| 143 &result)); | 141 &result)); |
| 144 EXPECT_EQ(expect_script, result); | 142 EXPECT_EQ(expect_script, result); |
| 145 } | 143 } |
| 146 | 144 |
| 147 FilePath preferences_file_; | 145 FilePath preferences_file_; |
| 148 FilePath extensions_dir_; | 146 FilePath extensions_dir_; |
| 149 FilePath user_scripts_dir_; | 147 FilePath user_scripts_dir_; |
| 150 bool enable_extensions_; | 148 bool enable_extensions_; |
| 151 // Extensions to load from the command line. | 149 // Extensions to load from the command line. |
| 152 std::vector<FilePath::StringType> load_extensions_; | 150 std::vector<FilePath::StringType> load_extensions_; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 .AppendASCII("extensions") | 273 .AppendASCII("extensions") |
| 276 .AppendASCII("app2"); | 274 .AppendASCII("app2"); |
| 277 load_extensions_.push_back(fourth_extension_path.value()); | 275 load_extensions_.push_back(fourth_extension_path.value()); |
| 278 } | 276 } |
| 279 }; | 277 }; |
| 280 | 278 |
| 281 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { | 279 IN_PROC_BROWSER_TEST_F(ExtensionsLoadMultipleTest, Test) { |
| 282 WaitForServicesToStart(4, true); | 280 WaitForServicesToStart(4, true); |
| 283 TestInjection(true, true); | 281 TestInjection(true, true); |
| 284 } | 282 } |
| OLD | NEW |