OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 stage = 'DOM'; | |
Finnur
2014/08/28 11:15:39
Add:
// Keeps track of who should be receiving key
David Tseng
2014/08/28 23:37:11
Done.
| |
6 | |
7 function gotCommand(command) { | |
8 if (stage == 'onCommand') { | |
9 stage = 'DOM'; | |
10 chrome.commands.onCommand.removeListener(gotCommand); | |
11 chrome.test.notifyPass(); | |
12 } else { | |
13 chrome.test.notifyFail('Unexpected call to onCommand'); | |
Finnur
2014/08/28 11:15:39
nit: Change error to something like:
'Webpage expe
David Tseng
2014/08/28 23:37:11
Done.
| |
14 } | |
15 } | |
16 | |
17 chrome.extension.onConnect.addListener(function(port) { | |
18 port.onMessage.addListener(function(message) { | |
19 if (stage == 'DOM') { | |
20 stage = 'onCommand'; | |
21 chrome.commands.onCommand.addListener(gotCommand); | |
22 chrome.test.notifyPass(); | |
23 } else { | |
24 chrome.test.notifyFail('Unexpected key event on page'); | |
Finnur
2014/08/28 11:15:39
nit: Change error to something like:
'Extension ex
| |
25 } | |
26 }); | |
27 } ); | |
Finnur
2014/08/28 11:15:39
nit: Extra spaces.
| |
28 | |
29 chrome.test.notifyPass(); | |
OLD | NEW |