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

Side by Side Diff: chrome/test/data/extensions/api_test/content_scripts/policy/background.js

Issue 2833843004: Reland: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Removed unused URLPatternSet parameters in ExtensionMsg_PermissionSetStruct which was causing MSAN … Created 3 years, 8 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var pass = chrome.test.callbackPass;
6 var callbackFail = chrome.test.callbackFail;
7 var listenForever = chrome.test.listenForever;
8
9 var port;
10
11 function testUrl(domain) {
12 return 'http://' + domain + ':' + port +
13 '/extensions/test_file.html';
14 }
15
16 function error(domain) {
17 return 'Cannot access contents of url "' + testUrl(domain) + '".' +
18 ' Extension manifest must request permission to access this host.';
19 }
20
21 // Creates a new tab, navigated to the specified |domain|.
22 function createTestTab(domain, callback) {
23 var createdTabId = -1;
24 var done = listenForever(
25 chrome.tabs.onUpdated,
26 function(tabId, changeInfo, tab) {
27 if (tabId == createdTabId && changeInfo.status != 'loading') {
28 callback(tab);
29 done();
30 }
31 });
32
33 chrome.tabs.create({url: testUrl(domain)}, pass(function(tab) {
34 createdTabId = tab.id;
35 }));
36 }
37
38 chrome.test.getConfig(function(config) {
39 port = config.testServer.port;
40 chrome.test.runTests([
41
42 // Make sure we can't inject a script into a policy blocked host.
43 function policyBlocksInjection() {
44 createTestTab('example.com', pass(function(tab) {
45 chrome.tabs.executeScript(
46 tab.id, {code: 'document.title = "success"'},
47 callbackFail(
48 'This page cannot be scripted due to ' +
49 'an ExtensionsSettings policy.'));
50 }));
51 },
52 ]);
53 });
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | chrome/test/data/extensions/api_test/content_scripts/policy/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698