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