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
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;
19 // Make the expected URLs non-relative, and sort them.
20 var expectedUrls = expectedViewURLs.map(function(url) {
21 return chrome.extension.getURL(url);
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() {}));