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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..be02705b93056d3b61d99c91644a79c55ad29f8b
--- /dev/null
+++ b/extensions/test/data/media_perception_private/state/runtest.js
@@ -0,0 +1,52 @@
+// 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.
+
+function getStateUninitialized() {
+ chrome.mediaPerceptionPrivate.getState(
+ chrome.test.callbackPass(function(state) {
+ chrome.test.assertEq({ status: 'UNINITIALIZED' }, state);
+ }));
+}
+
+function setStateRunning() {
+ chrome.mediaPerceptionPrivate.setState({
+ status: 'RUNNING',
+ deviceContext: 'device_context'
+ }, chrome.test.callbackPass(function(state) {
+ chrome.test.assertEq('RUNNING', state.status);
+ }));
+}
+
+function getStateRunning() {
+ chrome.mediaPerceptionPrivate.getState(
+ chrome.test.callbackPass(function(state) {
+ chrome.test.assertEq('RUNNING', state.status);
+ }));
+}
+
+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]);
+
« 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