OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 // Set the state to STARTED to automatically start listening to | |
6 // MediaPerceptionDetection signals. | |
7 let statusEnum = "STARTED" | |
tbarzic
2017/04/27 20:37:35
I'd inline these.
Luke Sorenson
2017/05/03 23:56:06
Done.
| |
8 let state = { status: statusEnum } | |
9 | |
10 function setState() { | |
11 chrome.mediaPerceptionPrivate.setState( | |
12 state, chrome.test.callback(stateCallback)); | |
tbarzic
2017/04/27 20:37:35
chrome.test.callbackPass instead of chrome.test.ca
Luke Sorenson
2017/05/03 23:56:06
Done.
| |
13 } | |
14 | |
15 function stateCallback(response) { | |
tbarzic
2017/04/27 20:37:35
can you inline this?
Luke Sorenson
2017/05/03 23:56:06
Done.
| |
16 chrome.test.assertEq(response.status, statusEnum); | |
17 } | |
18 | |
19 function registerListener() { | |
20 chrome.mediaPerceptionPrivate.onMediaPerception.addListener( | |
21 function(response) { | |
tbarzic
2017/04/27 20:37:35
You can do this as:
chrome.test.listenOnce(
ch
Luke Sorenson
2017/05/03 23:56:06
Done.
| |
22 chrome.test.assertEq(response.timestamp, 1); | |
23 chrome.test.succeed(); | |
24 }); | |
25 chrome.test.notifyPass(); | |
26 } | |
27 | |
28 chrome.test.runTests([setState, registerListener]); | |
29 | |
OLD | NEW |