Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / tabs / basics / get_views_common.js
blobc9f58a9db22d0c23428cefac3db6a8a012a60d81
1 // Open a window using chrome.windows.create(options),
2 // and see that chrome.extension.getViews() can find all the tabs
3 // in the window by searching for views with the window ID of the
4 // window we opened.
5 // Put in a common file because tests that use this function
6 // are too slow to be run as part of a single browser test.
7 function testGetNewWindowView(options, expectedViewURLs) {
8 chrome.windows.create(options, pass(function(win) {
10 // Wait for tabs to load, so we can look at window.location.href.
11 waitForAllTabs(pass(function() {
12 var views = chrome.extension.getViews({'windowId': win.id});
14 // Build a sorted array of the URLs in |views|.
15 var actualUrls = views.map(function(view) {
16 return view.location.href;
17 }).sort();
19 // Make the expected URLs non-relative, and sort them.
20 var expectedUrls = expectedViewURLs.map(function(url) {
21 return chrome.extension.getURL(url);
22 }).sort();
24 // Comparing JSON makes errors easy to read.
25 assertEq(JSON.stringify(expectedUrls, null, 2),
26 JSON.stringify(actualUrls, null, 2))
27 chrome.windows.remove(win.id, pass(function() {}));
28 }));
29 }));