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/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
15 #include "net/base/mock_host_resolver.h" | 16 #include "net/base/mock_host_resolver.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ui_test_utils::NavigateToURL( | 138 ui_test_utils::NavigateToURL( |
138 browser(), test_server()->GetURL("events.html")); | 139 browser(), test_server()->GetURL("events.html")); |
139 | 140 |
140 // 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 |
141 // listening for. | 142 // listening for. |
142 ui_test_utils::NavigateToURLWithDisposition( | 143 ui_test_utils::NavigateToURLWithDisposition( |
143 browser(), extension->GetResourceURL("fire_event.html"), | 144 browser(), extension->GetResourceURL("fire_event.html"), |
144 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); | 145 NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); |
145 EXPECT_TRUE(catcher.GetNextResult()); | 146 EXPECT_TRUE(catcher.GetNextResult()); |
146 } | 147 } |
| 148 |
| 149 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptPermissionsApi) { |
| 150 RequestPermissionsFunction::SetIgnoreUserGestureForTests(true); |
| 151 RequestPermissionsFunction::SetAutoConfirmForTests(true); |
| 152 host_resolver()->AddRule("*.com", "127.0.0.1"); |
| 153 ASSERT_TRUE(StartTestServer()); |
| 154 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; |
| 155 } |
OLD | NEW |