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 function getStateUninitialized() { |
| 6 chrome.mediaPerceptionPrivate.getState( |
| 7 chrome.test.callbackPass(function(state) { |
| 8 chrome.test.assertEq({ status: 'UNINITIALIZED' }, state); |
| 9 })); |
| 10 } |
| 11 |
| 12 function setStateRunning() { |
| 13 chrome.mediaPerceptionPrivate.setState({ |
| 14 status: 'RUNNING', |
| 15 deviceContext: 'device_context' |
| 16 }, chrome.test.callbackPass(function(state) { |
| 17 chrome.test.assertEq('RUNNING', state.status); |
| 18 })); |
| 19 } |
| 20 |
| 21 function getStateRunning() { |
| 22 chrome.mediaPerceptionPrivate.getState( |
| 23 chrome.test.callbackPass(function(state) { |
| 24 chrome.test.assertEq('RUNNING', state.status); |
| 25 })); |
| 26 } |
| 27 |
| 28 function setStateUnsettable() { |
| 29 const error = 'Status can only be set to RUNNING and SUSPENDED.'; |
| 30 chrome.mediaPerceptionPrivate.setState({ |
| 31 status: 'UNINITIALIZED' |
| 32 }, chrome.test.callbackFail(error)); |
| 33 chrome.mediaPerceptionPrivate.setState({ |
| 34 status: 'STARTED' |
| 35 }, chrome.test.callbackFail(error)); |
| 36 } |
| 37 |
| 38 function setStateSuspendedButWithDeviceContextFail() { |
| 39 const error = 'Only provide deviceContext with SetState RUNNING.'; |
| 40 chrome.mediaPerceptionPrivate.setState({ |
| 41 status: 'SUSPENDED', |
| 42 deviceContext: 'device_context' |
| 43 }, chrome.test.callbackFail(error)); |
| 44 } |
| 45 |
| 46 chrome.test.runTests([ |
| 47 getStateUninitialized, |
| 48 setStateRunning, |
| 49 getStateRunning, |
| 50 setStateUnsettable, |
| 51 setStateSuspendedButWithDeviceContextFail]); |
| 52 |
OLD | NEW |