| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 var testTab = { url: 'a.html', width: 200, height: 200 }; | |
| 6 var testTabId; | |
| 7 | |
| 8 chrome.test.runTests([ | |
| 9 function init() { | |
| 10 chrome.test.listenOnce( | |
| 11 chrome.experimental.offscreenTabs.onUpdated, | |
| 12 function(tabId, changeInfo, tab) { | |
| 13 assertSimilarTabs(testTab, tab); | |
| 14 }); | |
| 15 | |
| 16 chrome.experimental.offscreenTabs.create(testTab, pass(function(tab) { | |
| 17 assertSimilarTabs(testTab, tab); | |
| 18 testTabId = tab.id; | |
| 19 })); | |
| 20 }, | |
| 21 | |
| 22 // Test that keyboard events work by sending a 'q' keypress to a.html. The | |
| 23 // page has a keypress handler that will navigate the page to c.html. | |
| 24 function keyPress() { | |
| 25 chrome.test.listenOnce( | |
| 26 chrome.experimental.offscreenTabs.onUpdated, | |
| 27 function(tabId, changeInfo, tab) { | |
| 28 testTab.url = 'c.html'; | |
| 29 assertEq(maybeExpandURL('c.html'), changeInfo.url); | |
| 30 assertSimilarTabs(testTab, tab); | |
| 31 assertEq(tabId, tab.id); | |
| 32 assertEq(tabId, testTabId); | |
| 33 }); | |
| 34 | |
| 35 chrome.experimental.offscreenTabs.sendKeyboardEvent( | |
| 36 testTabId, getKeyboardEvent(Q_KEY), pass(function() { | |
| 37 chrome.experimental.offscreenTabs.get(testTabId, pass(function(tab) { | |
| 38 assertSimilarTabs(testTab, tab); | |
| 39 })); | |
| 40 })); | |
| 41 } | |
| 42 | |
| 43 // TODO(jstritar): Test event validation and edge cases. | |
| 44 ]); | |
| OLD | NEW |