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

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

Issue 11824004: Do not pass URLs in onUpdated events to extensions unless they have the (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add test cases 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 expectedEventData;
6 var capturedEventData;
not at google - send to devlin 2013/01/09 21:54:31 instead of all this global stuff (variables/onUpda
mvrable 2013/01/09 22:22:59 Done.
7
8 function onUpdateListener(tabId, info, tab) {
9 console.log('---onUpdated: ' + info.status + ', ' + info.url);
not at google - send to devlin 2013/01/09 21:54:31 remove logs
mvrable 2013/01/09 22:22:59 Done.
10 capturedEventData.push(info);
11 checkExpectations();
12 }
13
14 function checkExpectations() {
15 if (capturedEventData.length < expectedEventData.length) {
16 return;
17 }
18 chrome.tabs.onUpdated.removeListener(onUpdateListener);
19 chrome.test.assertEq(JSON.stringify(expectedEventData),
20 JSON.stringify(capturedEventData));
not at google - send to devlin 2013/01/09 21:54:31 I think assertEq works with objects?
mvrable 2013/01/09 22:22:59 Done.
21 chrome.test.succeed();
22 }
23
24 function expect(data, ignoreFunc) {
25 chrome.tabs.onUpdated.addListener(onUpdateListener);
26 expectedEventData = data;
27 capturedEventData = [];
28 }
29
30 chrome.test.runTests([
31 function noOnUpdateUrls() {
not at google - send to devlin 2013/01/09 21:54:31 i'd call these just testOnUpdated/testQuery.
mvrable 2013/01/09 22:22:59 Done.
32 expect([
33 { status: 'loading' },
34 { status: 'complete' }
35 ]);
36 chrome.tabs.create({ url: 'chrome://newtab/' });
37 },
38
39 function noQueryUrl() {
40 chrome.tabs.create({ url: 'chrome://newtab/' });
41 chrome.tabs.query({active: true}, chrome.test.callbackPass(function(tabs) {
42 console.log('---queryActive: ' + JSON.stringify(tabs));
43 chrome.test.assertEq(1, tabs.length);
44 chrome.test.assertEq(undefined, tabs[0].url);
45 }));
46 },
47
48 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698