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

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

Issue 20081002: Remove experimental permission from infobars API and moving it to dev channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added license header Created 7 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // API test for chrome.extension.infobars. 5 // API test for chrome.extension.infobars.
6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Infobars 6 // browser_tests.exe --gtest_filter=ExtensionApiTest.Infobars
7 7
8 const assertEq = chrome.test.assertEq; 8 const assertEq = chrome.test.assertEq;
9 9
10 var windowA = 0; 10 var windowA = 0;
(...skipping 11 matching lines...) Expand all
22 chrome.tabs.getSelected(null, function(tab) { 22 chrome.tabs.getSelected(null, function(tab) {
23 tabA = tab.id; 23 tabA = tab.id;
24 windowA = tab.windowId; 24 windowA = tab.windowId;
25 console.log('tabid: ' + tabA + ' windowA: ' + windowA); 25 console.log('tabid: ' + tabA + ' windowA: ' + windowA);
26 26
27 chrome.windows.create({"url": "about:blank"}, function(window) { 27 chrome.windows.create({"url": "about:blank"}, function(window) {
28 windowB = window.id; 28 windowB = window.id;
29 console.log('windowB: ' + windowB); 29 console.log('windowB: ' + windowB);
30 30
31 // Show infobarA in window A (tab A) (and specify no callback). 31 // Show infobarA in window A (tab A) (and specify no callback).
32 chrome.experimental.infobars.show({"path": "infobarA.html", 32 chrome.infobars.show({"path": "infobarA.html", "tabId": tabA});
33 "tabId": tabA});
34 // Flow continues in infobarCallbackA. 33 // Flow continues in infobarCallbackA.
35 }); 34 });
36 }); 35 });
37 } 36 }
38 ]; 37 ];
39 38
40 function infobarCallbackA() { 39 function infobarCallbackA() {
41 // We have now added an infobar so the total count goes up one. 40 // We have now added an infobar so the total count goes up one.
42 assertEq(2, chrome.extension.getViews().length); 41 assertEq(2, chrome.extension.getViews().length);
43 assertEq(1, chrome.extension.getViews({"type": "infobar"}).length); 42 assertEq(1, chrome.extension.getViews({"type": "infobar"}).length);
44 // Window A should have 1 infobar. 43 // Window A should have 1 infobar.
45 assertEq(1, chrome.extension.getViews({"type": "infobar", 44 assertEq(1, chrome.extension.getViews({"type": "infobar",
46 "windowId": windowA}).length); 45 "windowId": windowA}).length);
47 // Window B should have no infobars. 46 // Window B should have no infobars.
48 assertEq(0, chrome.extension.getViews({"type": "infobar", 47 assertEq(0, chrome.extension.getViews({"type": "infobar",
49 "windowId": windowB}).length); 48 "windowId": windowB}).length);
50 49
51 chrome.tabs.getAllInWindow(windowB, function(tabs) { 50 chrome.tabs.getAllInWindow(windowB, function(tabs) {
52 assertEq(1, tabs.length); 51 assertEq(1, tabs.length);
53 tabB = tabs[0].id; 52 tabB = tabs[0].id;
54 53
55 // Show infobarB in (current) window B (with callback). 54 // Show infobarB in (current) window B (with callback).
56 chrome.experimental.infobars.show({"path": "infobarB.html", 55 chrome.infobars.show({"path": "infobarB.html", "tabId": tabB},
57 "tabId": tabB}, 56 function(window) {
58 function(window) {
59 assertEq(window.id, windowB); 57 assertEq(window.id, windowB);
60 // This infobar will call back to us through infobarCallbackB (below). 58 // This infobar will call back to us through infobarCallbackB (below).
61 }); 59 });
62 }); 60 });
63 } 61 }
64 62
65 function infobarCallbackB() { 63 function infobarCallbackB() {
66 // We have now added an infobar so the total count goes up one. 64 // We have now added an infobar so the total count goes up one.
67 assertEq(3, chrome.extension.getViews().length); 65 assertEq(3, chrome.extension.getViews().length);
68 assertEq(2, chrome.extension.getViews({"type": "infobar"}).length); 66 assertEq(2, chrome.extension.getViews({"type": "infobar"}).length);
69 67
70 // Window A should have 1 infobar. 68 // Window A should have 1 infobar.
71 assertEq(1, chrome.extension.getViews({"type": "infobar", 69 assertEq(1, chrome.extension.getViews({"type": "infobar",
72 "windowId": windowA}).length); 70 "windowId": windowA}).length);
73 // Window B should have 1 infobar. 71 // Window B should have 1 infobar.
74 assertEq(1, chrome.extension.getViews({"type": "infobar", 72 assertEq(1, chrome.extension.getViews({"type": "infobar",
75 "windowId": windowB}).length); 73 "windowId": windowB}).length);
76 74
77 chrome.test.notifyPass(); 75 chrome.test.notifyPass();
78 } 76 }
79 77
80 chrome.test.runTests(tests); 78 chrome.test.runTests(tests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698