| Index: chrome/test/data/extensions/api_test/keybinding/continue_propagation/background.js
|
| diff --git a/chrome/test/data/extensions/api_test/keybinding/continue_propagation/background.js b/chrome/test/data/extensions/api_test/keybinding/continue_propagation/background.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..88338a1a0f1cb0e6e3a1be5dc7be24ffcf1e6b68
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/keybinding/continue_propagation/background.js
|
| @@ -0,0 +1,32 @@
|
| +// Copyright 2014 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.
|
| +
|
| +// Keeps track of who should be receiving keystrokes sent:
|
| +// The 'webPage' or the 'backgroundPage'.
|
| +var expectedListener = 'webPage';
|
| +
|
| +function gotCommand(command) {
|
| + if (expectedListener == 'backgroundPage') {
|
| + expectedListener = 'webPage';
|
| + chrome.commands.onCommand.removeListener(gotCommand);
|
| + chrome.test.notifyPass();
|
| + } else {
|
| + chrome.test.notifyFail('Webpage expected keystroke, but sent to extension');
|
| + }
|
| +}
|
| +
|
| +chrome.extension.onConnect.addListener(function(port) {
|
| + port.onMessage.addListener(function(message) {
|
| + if (expectedListener == 'webPage') {
|
| + expectedListener = 'backgroundPage';
|
| + chrome.commands.onCommand.addListener(gotCommand);
|
| + chrome.test.notifyPass();
|
| + } else {
|
| + chrome.test.notifyFail('Extension expected keystroke, but sent to' +
|
| + ' webpage');
|
| + }
|
| + });
|
| +});
|
| +
|
| +chrome.test.notifyPass();
|
|
|