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

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

Issue 2858353002: MediaPerceptionPrivate API impl and testing. (Closed)
Patch Set: Addressing comments on API implementation. 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..138fd98e5f6909a44e0e8eadcfe659f88e57a014
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/media_perception_private/state/runtest.js
@@ -0,0 +1,29 @@
+// 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'
+let state = { status: kStatusEnum }
+
+function setState() {
+ chrome.mediaPerceptionPrivate.setState(
+ state, chrome.test.callback(stateCallback));
+}
+
+function getState() {
+ chrome.mediaPerceptionPrivate.getState(
+ chrome.test.callback(stateCallback));
+}
+
+function setStateUnsettable() {
+ state.status = 'UNINITIALIZED'
+ const error = 'Settable statuses are RUNNING and SUSPENDED.'
+ chrome.mediaPerceptionPrivate.setState(state, fail(error));
+}
+
+function stateCallback(response) {
+ chrome.test.assertEq(response.status, kStatusEnum);
tbarzic 2017/05/09 01:28:36 I don't think it's worth having this as a separate
Luke Sorenson 2017/05/09 21:05:44 Done. Fine with getting rid of the callback method
tbarzic 2017/05/09 21:19:14 yes, but a couple should be OK to inline
Luke Sorenson 2017/05/10 18:50:16 I've got more than a couple now :)
tbarzic 2017/05/11 00:38:26 still, not too many - I find the inlined version e
Luke Sorenson 2017/05/11 23:57:58 Acknowledged.
+}
+
+chrome.test.runTests([setState, getState]);
+

Powered by Google App Engine
This is Rietveld 408576698