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

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: Reverted the app.yaml version change 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",
33 "tabId": tabA}); 33 "tabId": tabA});
Matt Perry 2013/07/26 18:26:24 fix the indent here
pals 2013/07/29 06:04:04 Done.
34 // Flow continues in infobarCallbackA. 34 // Flow continues in infobarCallbackA.
35 }); 35 });
36 }); 36 });
37 } 37 }
38 ]; 38 ];
39 39
40 function infobarCallbackA() { 40 function infobarCallbackA() {
41 // We have now added an infobar so the total count goes up one. 41 // We have now added an infobar so the total count goes up one.
42 assertEq(2, chrome.extension.getViews().length); 42 assertEq(2, chrome.extension.getViews().length);
43 assertEq(1, chrome.extension.getViews({"type": "infobar"}).length); 43 assertEq(1, chrome.extension.getViews({"type": "infobar"}).length);
44 // Window A should have 1 infobar. 44 // Window A should have 1 infobar.
45 assertEq(1, chrome.extension.getViews({"type": "infobar", 45 assertEq(1, chrome.extension.getViews({"type": "infobar",
46 "windowId": windowA}).length); 46 "windowId": windowA}).length);
47 // Window B should have no infobars. 47 // Window B should have no infobars.
48 assertEq(0, chrome.extension.getViews({"type": "infobar", 48 assertEq(0, chrome.extension.getViews({"type": "infobar",
49 "windowId": windowB}).length); 49 "windowId": windowB}).length);
50 50
51 chrome.tabs.getAllInWindow(windowB, function(tabs) { 51 chrome.tabs.getAllInWindow(windowB, function(tabs) {
52 assertEq(1, tabs.length); 52 assertEq(1, tabs.length);
53 tabB = tabs[0].id; 53 tabB = tabs[0].id;
54 54
55 // Show infobarB in (current) window B (with callback). 55 // Show infobarB in (current) window B (with callback).
56 chrome.experimental.infobars.show({"path": "infobarB.html", 56 chrome.infobars.show({"path": "infobarB.html",
57 "tabId": tabB}, 57 "tabId": tabB},
Matt Perry 2013/07/26 18:26:24 ditto
pals 2013/07/29 06:04:04 Done.
58 function(window) { 58 function(window) {
59 assertEq(window.id, windowB); 59 assertEq(window.id, windowB);
60 // This infobar will call back to us through infobarCallbackB (below). 60 // This infobar will call back to us through infobarCallbackB (below).
61 }); 61 });
62 }); 62 });
63 } 63 }
64 64
65 function infobarCallbackB() { 65 function infobarCallbackB() {
66 // We have now added an infobar so the total count goes up one. 66 // We have now added an infobar so the total count goes up one.
67 assertEq(3, chrome.extension.getViews().length); 67 assertEq(3, chrome.extension.getViews().length);
68 assertEq(2, chrome.extension.getViews({"type": "infobar"}).length); 68 assertEq(2, chrome.extension.getViews({"type": "infobar"}).length);
69 69
70 // Window A should have 1 infobar. 70 // Window A should have 1 infobar.
71 assertEq(1, chrome.extension.getViews({"type": "infobar", 71 assertEq(1, chrome.extension.getViews({"type": "infobar",
72 "windowId": windowA}).length); 72 "windowId": windowA}).length);
73 // Window B should have 1 infobar. 73 // Window B should have 1 infobar.
74 assertEq(1, chrome.extension.getViews({"type": "infobar", 74 assertEq(1, chrome.extension.getViews({"type": "infobar",
75 "windowId": windowB}).length); 75 "windowId": windowB}).length);
76 76
77 chrome.test.notifyPass(); 77 chrome.test.notifyPass();
78 } 78 }
79 79
80 chrome.test.runTests(tests); 80 chrome.test.runTests(tests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698