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 let kStatusEnum = 'RUNNING' | |
tbarzic
2017/05/11 00:38:27
can you just create new state object in tests?
Luke Sorenson
2017/05/11 23:57:58
Done.
| |
6 var state = { status: kStatusEnum } | |
7 | |
8 function setState() { | |
9 state.deviceContext = 'Just a string.'; | |
tbarzic
2017/05/11 00:38:27
can you set this to something little more meaningf
Luke Sorenson
2017/05/11 23:57:58
Done.
| |
10 chrome.mediaPerceptionPrivate.setState( | |
11 state, chrome.test.callbackPass(function(state) { | |
12 chrome.test.assertEq(state.status, kStatusEnum); | |
13 })); | |
14 } | |
15 | |
16 function getState() { | |
17 chrome.mediaPerceptionPrivate.getState( | |
18 chrome.test.callbackPass(function(state) { | |
19 chrome.test.assertEq(state.status, kStatusEnum); | |
20 })); | |
21 } | |
22 | |
23 function setStateUnsettable() { | |
24 state.status = 'UNINITIALIZED'; | |
tbarzic
2017/05/11 00:38:27
what about other states?
Luke Sorenson
2017/05/11 23:57:58
Done.
| |
25 const error = 'Status can only be set to RUNNING and SUSPENDED.'; | |
26 chrome.mediaPerceptionPrivate.setState( | |
27 state, chrome.test.callbackFail(error)); | |
28 } | |
29 | |
30 function setStateSuspendedButWithDeviceContextFail() { | |
31 state.status = 'SUSPENDED'; | |
32 state.deviceContext = 'Just a string.'; | |
33 const error = 'Only provide deviceContext with SetState RUNNING.'; | |
tbarzic
2017/05/11 00:38:27
can you test there's an error if the current state
Luke Sorenson
2017/05/11 23:57:58
That isn't an error case. Setting the desired stat
| |
34 chrome.mediaPerceptionPrivate.setState( | |
35 state, chrome.test.callbackFail(error)); | |
36 } | |
37 | |
38 chrome.test.runTests([ | |
39 setState, | |
40 getState, | |
41 setStateUnsettable, | |
42 setStateSuspendedButWithDeviceContextFail]); | |
43 | |
OLD | NEW |