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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/extensions/api/permissions/permissions_api.h" | 6 #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 GURL url(test_server()->GetURL("file/extensions/test_file.html")); | 116 GURL url(test_server()->GetURL("file/extensions/test_file.html")); |
117 ui_test_utils::NavigateToURL(browser(), url); | 117 ui_test_utils::NavigateToURL(browser(), url); |
118 | 118 |
119 LoadExtension( | 119 LoadExtension( |
120 test_data_dir_.AppendASCII("content_scripts/existing_renderers")); | 120 test_data_dir_.AppendASCII("content_scripts/existing_renderers")); |
121 | 121 |
122 signal.Wait(); | 122 signal.Wait(); |
123 | 123 |
124 // And check that its styles were affected by the styles that just got loaded. | 124 // And check that its styles were affected by the styles that just got loaded. |
125 bool styles_injected; | 125 bool styles_injected; |
126 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 126 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
127 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 127 chrome::GetActiveWebContents(browser()), |
128 "", | |
129 "window.domAutomationController.send(" | 128 "window.domAutomationController.send(" |
130 " document.defaultView.getComputedStyle(document.body, null)." | 129 " document.defaultView.getComputedStyle(document.body, null)." |
131 " getPropertyValue('background-color') == 'rgb(255, 0, 0)')", | 130 " getPropertyValue('background-color') == 'rgb(255, 0, 0)')", |
132 &styles_injected)); | 131 &styles_injected)); |
133 ASSERT_TRUE(styles_injected); | 132 ASSERT_TRUE(styles_injected); |
134 } | 133 } |
135 | 134 |
136 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, | 135 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, |
137 ContentScriptCSSLocalization) { | 136 ContentScriptCSSLocalization) { |
138 ASSERT_TRUE(StartTestServer()); | 137 ASSERT_TRUE(StartTestServer()); |
(...skipping 29 matching lines...) Expand all Loading... |
168 RequestPermissionsFunction::SetAutoConfirmForTests(true); | 167 RequestPermissionsFunction::SetAutoConfirmForTests(true); |
169 host_resolver()->AddRule("*.com", "127.0.0.1"); | 168 host_resolver()->AddRule("*.com", "127.0.0.1"); |
170 ASSERT_TRUE(StartTestServer()); | 169 ASSERT_TRUE(StartTestServer()); |
171 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; | 170 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; |
172 } | 171 } |
173 | 172 |
174 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { | 173 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { |
175 ASSERT_TRUE(StartTestServer()); | 174 ASSERT_TRUE(StartTestServer()); |
176 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; | 175 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; |
177 } | 176 } |
OLD | NEW |