OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var secondWindowId; | 5 var secondWindowId; |
6 var thirdWindowId; | 6 var thirdWindowId; |
7 var testTabId; | 7 var testTabId; |
8 | 8 |
9 function clickLink(id) { | 9 function clickLink(id) { |
10 var clickEvent = document.createEvent('MouseEvents'); | 10 var clickEvent = document.createEvent('MouseEvents'); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 function openerTabId() { | 103 function openerTabId() { |
104 chrome.test.listenOnce( | 104 chrome.test.listenOnce( |
105 chrome.tabs.onCreated, | 105 chrome.tabs.onCreated, |
106 function(tab) { | 106 function(tab) { |
107 chrome.tabs.getCurrent(pass(function(thisTab) { | 107 chrome.tabs.getCurrent(pass(function(thisTab) { |
108 assertEq(thisTab.id, tab.openerTabId); | 108 assertEq(thisTab.id, tab.openerTabId); |
109 })); | 109 })); |
110 }); | 110 }); |
111 // Pretend to click a link (openers aren't tracked when using tabs.create). | 111 // Pretend to click a link (openers aren't tracked when using tabs.create). |
112 clickLink("test_link"); | 112 clickLink("test_link"); |
| 113 }, |
| 114 |
| 115 // The window on chrome.tabs.create is ignored if it doesn't accept tabs. |
| 116 function testRedirectingToAnotherWindow() { |
| 117 chrome.windows.create( |
| 118 {url: 'about:blank', type: 'popup'}, |
| 119 pass(function(window) { |
| 120 chrome.tabs.create( |
| 121 {url: 'about:blank', windowId: window.id}, |
| 122 pass(function(tab) { |
| 123 assertTrue(window.id != tab.windowId); |
| 124 })); |
| 125 })); |
113 } | 126 } |
114 | |
115 ]); | 127 ]); |
OLD | NEW |