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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/javascript_url_permissions/test.js

Issue 8762014: Move another set of extension tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 chrome.test.getConfig(function(config) {
6 var javaScriptURL = "javascript:void(document.body.bgColor='red')";
7
8 var fixPort = function(url) {
9 return url.replace(/PORT/, config.testServer.port);
10 };
11 var urlA = fixPort("http://a.com:PORT/files/extensions/test_file.html");
12 var urlB = fixPort("http://b.com:PORT/files/extensions/test_file.html");
13
14 chrome.tabs.create({ url: urlA }, function(tab) {
15 var firstTabId = tab.id;
16
17 chrome.tabs.create({ url: urlB }, function(tab) {
18 var secondTabId = tab.id;
19
20 chrome.test.runTests([
21 function javaScriptURLShouldFail() {
22 chrome.tabs.update(firstTabId, {url: javaScriptURL},
23 chrome.test.callbackFail('Cannot access contents of url ' +
24 '"' + urlA + '". Extension manifest must request ' +
25 'permission to access this host.'));
26 },
27
28 function javaScriptURLShouldSucceed() {
29 chrome.tabs.update(secondTabId, {url: javaScriptURL},
30 chrome.test.callbackPass());
31 }
32 ]);
33 });
34 });
35 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698