Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: extensions/test/data/media_perception_private/state/runtest.js

Issue 2858353002: MediaPerceptionPrivate API impl and testing. (Closed)
Patch Set: Added media_perception_proto as direct dependency of test targets. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/test/data/media_perception_private/state/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « extensions/test/data/media_perception_private/state/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698