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

Unified Diff: chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js

Issue 2858353002: MediaPerceptionPrivate API impl and testing. (Closed)
Patch Set: ImageFrameProtoToIdl and unittest 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
Index: chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js
diff --git a/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js b/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js
new file mode 100644
index 0000000000000000000000000000000000000000..a268f7e52eba58004d27fd9606f9f100160c138f
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js
@@ -0,0 +1,43 @@
+// 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.
+
+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.
+var state = { status: kStatusEnum }
+
+function setState() {
+ 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.
+ chrome.mediaPerceptionPrivate.setState(
+ state, chrome.test.callbackPass(function(state) {
+ chrome.test.assertEq(state.status, kStatusEnum);
+ }));
+}
+
+function getState() {
+ chrome.mediaPerceptionPrivate.getState(
+ chrome.test.callbackPass(function(state) {
+ chrome.test.assertEq(state.status, kStatusEnum);
+ }));
+}
+
+function setStateUnsettable() {
+ state.status = 'UNINITIALIZED';
tbarzic 2017/05/11 00:38:27 what about other states?
Luke Sorenson 2017/05/11 23:57:58 Done.
+ const error = 'Status can only be set to RUNNING and SUSPENDED.';
+ chrome.mediaPerceptionPrivate.setState(
+ state, chrome.test.callbackFail(error));
+}
+
+function setStateSuspendedButWithDeviceContextFail() {
+ state.status = 'SUSPENDED';
+ state.deviceContext = 'Just a string.';
+ 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
+ chrome.mediaPerceptionPrivate.setState(
+ state, chrome.test.callbackFail(error));
+}
+
+chrome.test.runTests([
+ setState,
+ getState,
+ setStateUnsettable,
+ setStateSuspendedButWithDeviceContextFail]);
+

Powered by Google App Engine
This is Rietveld 408576698