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

Side by Side Diff: chrome/test/data/extensions/api_test/incognito/apis/background.js

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 var normalWindow, normalTab; 5 var normalWindow, normalTab;
6 var incognitoWindow, incognitoTab; 6 var incognitoWindow, incognitoTab;
7 7
8 var pass = chrome.test.callbackPass; 8 var pass = chrome.test.callbackPass;
9 var fail = chrome.test.callbackFail; 9 var fail = chrome.test.callbackFail;
10 var assertEq = chrome.test.assertEq; 10 var assertEq = chrome.test.assertEq;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 var testUrl = "http://localhost:PORT/files/extensions/test_file.html" 86 var testUrl = "http://localhost:PORT/files/extensions/test_file.html"
87 .replace(/PORT/, config.testServer.port); 87 .replace(/PORT/, config.testServer.port);
88 88
89 // Test that chrome.extension.inIncognitoTab is true for incognito tabs. 89 // Test that chrome.extension.inIncognitoTab is true for incognito tabs.
90 chrome.tabs.create({windowId: incognitoWindow.id, url: testUrl}, 90 chrome.tabs.create({windowId: incognitoWindow.id, url: testUrl},
91 pass(function(tab) { 91 pass(function(tab) {
92 chrome.tabs.executeScript(tab.id, 92 chrome.tabs.executeScript(tab.id,
93 {code: 'document.title = chrome.extension.inIncognitoContext'}, 93 {code: 'document.title = chrome.extension.inIncognitoContext'},
94 pass(function() { 94 pass(function() {
95 assertEq(undefined, chrome.extension.lastError); 95 assertEq(undefined, chrome.runtime.lastError);
96 chrome.tabs.get(tab.id, pass(function(tab) { 96 chrome.tabs.get(tab.id, pass(function(tab) {
97 assertEq("true", tab.title); 97 assertEq("true", tab.title);
98 })); 98 }));
99 })); 99 }));
100 })); 100 }));
101 101
102 // ... and false for normal tabs. 102 // ... and false for normal tabs.
103 chrome.tabs.create({windowId: normalWindow.id, url: testUrl}, 103 chrome.tabs.create({windowId: normalWindow.id, url: testUrl},
104 pass(function(tab) { 104 pass(function(tab) {
105 chrome.tabs.executeScript(tab.id, 105 chrome.tabs.executeScript(tab.id,
106 {code: 'document.title = chrome.extension.inIncognitoContext'}, 106 {code: 'document.title = chrome.extension.inIncognitoContext'},
107 pass(function() { 107 pass(function() {
108 assertEq(undefined, chrome.extension.lastError); 108 assertEq(undefined, chrome.runtime.lastError);
109 chrome.tabs.get(tab.id, pass(function(tab) { 109 chrome.tabs.get(tab.id, pass(function(tab) {
110 assertEq("false", tab.title); 110 assertEq("false", tab.title);
111 })); 111 }));
112 })); 112 }));
113 })); 113 }));
114 }, 114 },
115 115
116 // Tests that extensions can't move tabs between incognito and 116 // Tests that extensions can't move tabs between incognito and
117 // non-incognito windows. 117 // non-incognito windows.
118 function moveTabBetweenProfiles() { 118 function moveTabBetweenProfiles() {
119 var errorMsg = "Tabs can only be moved between " + 119 var errorMsg = "Tabs can only be moved between " +
120 "windows in the same profile."; 120 "windows in the same profile.";
121 121
122 // Create a tab in the non-incognito window... 122 // Create a tab in the non-incognito window...
123 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'}, 123 chrome.tabs.create({windowId: normalWindow.id, url: 'about:blank'},
124 pass(function(tab) { 124 pass(function(tab) {
125 // ... and then try to move it to the incognito window. 125 // ... and then try to move it to the incognito window.
126 chrome.tabs.move(tab.id, 126 chrome.tabs.move(tab.id,
127 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg)); 127 {windowId: incognitoWindow.id, index: 0}, fail(errorMsg));
128 })); 128 }));
129 } 129 }
130 ]); 130 ]);
131 }); 131 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698