| Index: chrome/test/data/extensions/api_test/offscreen_tabs/keyboard_events.js
|
| diff --git a/chrome/test/data/extensions/api_test/offscreen_tabs/keyboard_events.js b/chrome/test/data/extensions/api_test/offscreen_tabs/keyboard_events.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e9b191aa2dae2cf7e337f0ef708455c4f746c8c9
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/offscreen_tabs/keyboard_events.js
|
| @@ -0,0 +1,44 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +var testTab = { url: 'a.html', width: 200, height: 200 };
|
| +var testTabId;
|
| +
|
| +chrome.test.runTests([
|
| + function init() {
|
| + chrome.test.listenOnce(
|
| + chrome.experimental.offscreenTabs.onUpdated,
|
| + function(tabId, changeInfo, tab) {
|
| + assertSimilarTabs(testTab, tab);
|
| + });
|
| +
|
| + chrome.experimental.offscreenTabs.create(testTab, pass(function(tab) {
|
| + assertSimilarTabs(testTab, tab);
|
| + testTabId = tab.id;
|
| + }));
|
| + },
|
| +
|
| + // Test that keyboard events work by sending a 'q' keypress to a.html. The
|
| + // page has a keypress handler that will navigate the page to c.html.
|
| + function keyPress() {
|
| + chrome.test.listenOnce(
|
| + chrome.experimental.offscreenTabs.onUpdated,
|
| + function(tabId, changeInfo, tab) {
|
| + testTab.url = 'c.html';
|
| + assertEq(maybeExpandURL('c.html'), changeInfo.url);
|
| + assertSimilarTabs(testTab, tab);
|
| + assertEq(tabId, tab.id);
|
| + assertEq(tabId, testTabId);
|
| + });
|
| +
|
| + chrome.experimental.offscreenTabs.sendKeyboardEvent(
|
| + testTabId, getKeyboardEvent(Q_KEY), pass(function() {
|
| + chrome.experimental.offscreenTabs.get(testTabId, pass(function(tab) {
|
| + assertSimilarTabs(testTab, tab);
|
| + }));
|
| + }));
|
| + }
|
| +
|
| + // TODO(jstritar): Test event validation and edge cases.
|
| +]);
|
|
|