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 |
| 8 chrome.test.runTests([ |
| 9 function setStateRunning() { |
| 10 // Need to start the mocked media analytics process. |
| 11 chrome.mediaPerceptionPrivate.setState({ |
| 12 status: 'RUNNING' |
| 13 }, chrome.test.callbackPass(function(state) { |
| 14 chrome.test.assertEq({ status: 'RUNNING' }, state); |
| 15 })); |
| 16 }, |
| 17 function registerListener() { |
| 18 chrome.test.listenOnce( |
| 19 chrome.mediaPerceptionPrivate.onMediaPerception, |
| 20 function(evt) { |
| 21 chrome.test.assertEq({ |
| 22 framePerceptions: [{ |
| 23 frameId: 1 |
| 24 }] |
| 25 }, evt); |
| 26 }); |
| 27 // By sending this message, we trigger the fake D-Bus client to fire an |
| 28 // onMediaPerception event. |
| 29 chrome.test.sendMessage('mediaPerceptionListenerSet'); |
| 30 } |
| 31 ]); |
| 32 |
OLD | NEW |