Chromium Code Reviews| Index: extensions/test/data/media_perception_private/state/runtest.js |
| diff --git a/extensions/test/data/media_perception_private/state/runtest.js b/extensions/test/data/media_perception_private/state/runtest.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0c65c52511525abb4a9ffee313a6b11802fd212c |
| --- /dev/null |
| +++ b/extensions/test/data/media_perception_private/state/runtest.js |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| + |
|
tbarzic
2017/05/17 21:04:42
remove extra new line
Luke Sorenson
2017/05/17 23:07:49
Done.
|
| +function getStateUninitialized() { |
| + chrome.mediaPerceptionPrivate.getState( |
| + chrome.test.callbackPass(function(state) { |
| + chrome.test.assertEq(state.status, 'UNINITIALIZED'); |
| + })); |
| +} |
| + |
| +function setStateRunning() { |
| + chrome.mediaPerceptionPrivate.setState({ |
| + status: 'RUNNING', |
| + deviceContext: 'device_context' |
| + }, chrome.test.callbackPass(function(state) { |
| + chrome.test.assertEq(state.status, 'RUNNING'); |
| + })); |
| +} |
| + |
| +function getStateRunning() { |
| + chrome.mediaPerceptionPrivate.getState( |
| + chrome.test.callbackPass(function(state) { |
| + chrome.test.assertEq(state.status, 'RUNNING'); |
| + })); |
| +} |
| + |
| +function setStateUnsettable() { |
| + const error = 'Status can only be set to RUNNING and SUSPENDED.'; |
| + chrome.mediaPerceptionPrivate.setState({ |
| + status: 'UNINITIALIZED' |
| + }, chrome.test.callbackFail(error)); |
| + chrome.mediaPerceptionPrivate.setState({ |
| + status: 'STARTED' |
| + }, chrome.test.callbackFail(error)); |
| +} |
| + |
| +function setStateSuspendedButWithDeviceContextFail() { |
| + const error = 'Only provide deviceContext with SetState RUNNING.'; |
| + chrome.mediaPerceptionPrivate.setState({ |
| + status: 'SUSPENDED', |
| + deviceContext: 'device_context' |
| + }, chrome.test.callbackFail(error)); |
| +} |
| + |
| +chrome.test.runTests([ |
| + getStateUninitialized, |
| + setStateRunning, |
| + getStateRunning, |
| + setStateUnsettable, |
| + setStateSuspendedButWithDeviceContextFail]); |
| + |