Index: chrome/test/data/extensions/api_test/media_perception_private/media_perception/runtest.js |
diff --git a/chrome/test/data/extensions/api_test/media_perception_private/media_perception/runtest.js b/chrome/test/data/extensions/api_test/media_perception_private/media_perception/runtest.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e9fb3fdc42bc0a57884706892a05c5517eff75ee |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/media_perception_private/media_perception/runtest.js |
@@ -0,0 +1,25 @@ |
+// 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. |
+ |
+// Set the state to STARTED to automatically start listening to |
+// MediaPerceptionDetection signals. |
+ |
+function registerListener() { |
+ chrome.test.listenOnce( |
+ chrome.mediaPerceptionPrivate.onMediaPerception, |
tbarzic
2017/05/09 01:28:36
setState directly causing an event to be dispathed
Luke Sorenson
2017/05/09 21:05:44
Done.
|
+ function(evt) { |
+ chrome.test.assertEq(evt.timestamp, 1); |
+ }); |
+ let kStatusEnum = "RUNNING"; |
+ chrome.mediaPerceptionPrivate.setState( |
+ { status: kStatusEnum }, chrome.test.callbackPass( |
+ function (response) { |
+ chrome.test.assertEq(response.status, kStatusEnum); |
+ })); |
+} |
+ |
+// By calling setState, we trigger the fake D-Bus client to fire an |
+// onMediaPerception event. |
+chrome.test.runTests([registerListener]); |
+ |