Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: chrome/browser/extensions/content_script_apitest.cc

Issue 226663003: Allow content script insertion on about:-URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move GetEffectiveDocumentURL to ScriptContext Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/api/permissions/permissions_api.h" 8 #include "chrome/browser/extensions/api/permissions/permissions_api.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ASSERT_TRUE(StartEmbeddedTestServer()); 77 ASSERT_TRUE(StartEmbeddedTestServer());
78 ASSERT_TRUE(RunExtensionTest("content_scripts/all_frames")) << message_; 78 ASSERT_TRUE(RunExtensionTest("content_scripts/all_frames")) << message_;
79 } 79 }
80 80
81 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAboutBlankIframes) { 81 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAboutBlankIframes) {
82 ASSERT_TRUE(StartEmbeddedTestServer()); 82 ASSERT_TRUE(StartEmbeddedTestServer());
83 ASSERT_TRUE( 83 ASSERT_TRUE(
84 RunExtensionTest("content_scripts/about_blank_iframes")) << message_; 84 RunExtensionTest("content_scripts/about_blank_iframes")) << message_;
85 } 85 }
86 86
87 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptAboutBlankAndSrcdoc) {
88 // The optional "*://*/*" permission is requested after verifying that
89 // content script insertion solely depends on content_scripts[*].matches.
90 // The permission is needed for chrome.tabs.executeScript tests.
91 PermissionsRequestFunction::SetAutoConfirmForTests(true);
92 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true);
93
94 ASSERT_TRUE(StartEmbeddedTestServer());
95 ASSERT_TRUE(RunExtensionTest("content_scripts/about_blank_srcdoc"))
96 << message_;
97 }
98
87 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionIframe) { 99 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionIframe) {
88 ASSERT_TRUE(StartEmbeddedTestServer()); 100 ASSERT_TRUE(StartEmbeddedTestServer());
89 ASSERT_TRUE(RunExtensionTest("content_scripts/extension_iframe")) << message_; 101 ASSERT_TRUE(RunExtensionTest("content_scripts/extension_iframe")) << message_;
90 } 102 }
91 103
92 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionProcess) { 104 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionProcess) {
93 ASSERT_TRUE(StartEmbeddedTestServer()); 105 ASSERT_TRUE(StartEmbeddedTestServer());
94 ASSERT_TRUE( 106 ASSERT_TRUE(
95 RunExtensionTest("content_scripts/extension_process")) << message_; 107 RunExtensionTest("content_scripts/extension_process")) << message_;
96 } 108 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ASSERT_TRUE(StartEmbeddedTestServer()); 279 ASSERT_TRUE(StartEmbeddedTestServer());
268 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_; 280 ASSERT_TRUE(RunExtensionTest("content_scripts/permissions")) << message_;
269 } 281 }
270 282
271 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) { 283 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptBypassPageCSP) {
272 ASSERT_TRUE(StartEmbeddedTestServer()); 284 ASSERT_TRUE(StartEmbeddedTestServer());
273 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_; 285 ASSERT_TRUE(RunExtensionTest("content_scripts/bypass_page_csp")) << message_;
274 } 286 }
275 287
276 } // namespace extensions 288 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/script_executor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698