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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_; |
121 } | 121 } |
122 | 122 |
123 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionAPIs) { | 123 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionAPIs) { |
124 ASSERT_TRUE(StartTestServer()); | 124 ASSERT_TRUE(StartTestServer()); |
125 | 125 |
126 CommandLine::ForCurrentProcess()->AppendSwitch( | 126 CommandLine::ForCurrentProcess()->AppendSwitch( |
127 switches::kEnableExperimentalExtensionApis); | 127 switches::kEnableExperimentalExtensionApis); |
128 const Extension* extension = LoadExtension( | 128 const extensions::Extension* extension = LoadExtension( |
129 test_data_dir_.AppendASCII("content_scripts/extension_api")); | 129 test_data_dir_.AppendASCII("content_scripts/extension_api")); |
130 | 130 |
131 ResultCatcher catcher; | 131 ResultCatcher catcher; |
132 ui_test_utils::NavigateToURL( | 132 ui_test_utils::NavigateToURL( |
133 browser(), test_server()->GetURL("functions.html")); | 133 browser(), test_server()->GetURL("functions.html")); |
134 EXPECT_TRUE(catcher.GetNextResult()); | 134 EXPECT_TRUE(catcher.GetNextResult()); |
135 | 135 |
136 // Navigate to a page that will cause a content script to run that starts | 136 // Navigate to a page that will cause a content script to run that starts |
137 // listening for an extension event. | 137 // listening for an extension event. |
138 ui_test_utils::NavigateToURL( | 138 ui_test_utils::NavigateToURL( |
139 browser(), test_server()->GetURL("events.html")); | 139 browser(), test_server()->GetURL("events.html")); |
140 | 140 |
141 // Navigate to an extension page that will fire the event events.js is | 141 // Navigate to an extension page that will fire the event events.js is |
142 // listening for. | 142 // listening for. |
143 ui_test_utils::NavigateToURLWithDisposition( | 143 ui_test_utils::NavigateToURLWithDisposition( |
144 browser(), extension->GetResourceURL("fire_event.html"), | 144 browser(), extension->GetResourceURL("fire_event.html"), |
145 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); | 145 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); |
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 |