| 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/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ui_test_utils::NavigateToURL(browser(), url); | 100 ui_test_utils::NavigateToURL(browser(), url); |
| 101 | 101 |
| 102 LoadExtension( | 102 LoadExtension( |
| 103 test_data_dir_.AppendASCII("content_scripts/existing_renderers")); | 103 test_data_dir_.AppendASCII("content_scripts/existing_renderers")); |
| 104 | 104 |
| 105 signal.Wait(); | 105 signal.Wait(); |
| 106 | 106 |
| 107 // And check that its styles were affected by the styles that just got loaded. | 107 // And check that its styles were affected by the styles that just got loaded. |
| 108 bool styles_injected; | 108 bool styles_injected; |
| 109 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 109 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 110 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", | 110 browser()->GetActiveWebContents()->GetRenderViewHost(), L"", |
| 111 L"window.domAutomationController.send(" | 111 L"window.domAutomationController.send(" |
| 112 L"document.defaultView.getComputedStyle(document.body, null)." | 112 L"document.defaultView.getComputedStyle(document.body, null)." |
| 113 L"getPropertyValue('background-color') == 'rgb(255, 0, 0)')", | 113 L"getPropertyValue('background-color') == 'rgb(255, 0, 0)')", |
| 114 &styles_injected)); | 114 &styles_injected)); |
| 115 ASSERT_TRUE(styles_injected); | 115 ASSERT_TRUE(styles_injected); |
| 116 } | 116 } |
| 117 | 117 |
| 118 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptCSSLocalization) { | 118 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptCSSLocalization) { |
| 119 ASSERT_TRUE(StartTestServer()); | 119 ASSERT_TRUE(StartTestServer()); |
| 120 ASSERT_TRUE(RunExtensionTest("content_scripts/css_l10n")) << message_; | 120 ASSERT_TRUE(RunExtensionTest("content_scripts/css_l10n")) << message_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 146 EXPECT_TRUE(catcher.GetNextResult()); | 146 EXPECT_TRUE(catcher.GetNextResult()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptPermissionsApi) { | 149 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptPermissionsApi) { |
| 150 RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); | 150 RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); |
| 151 RequestPermissionsFunction::SetAutoConfirmForTests(true); | 151 RequestPermissionsFunction::SetAutoConfirmForTests(true); |
| 152 host_resolver()->AddRule("*.com", "127.0.0.1"); | 152 host_resolver()->AddRule("*.com", "127.0.0.1"); |
| 153 ASSERT_TRUE(StartTestServer()); | 153 ASSERT_TRUE(StartTestServer()); |
| 154 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; | 154 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; |
| 155 } | 155 } |
| OLD | NEW |