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

Unified Diff: chrome/test/data/extensions/api_test/rtc_private/events/background.js

Issue 10919086: Wired chrome.rtcPrivate API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/rtc_private/events/background.js
diff --git a/chrome/test/data/extensions/api_test/rtc_private/events/background.js b/chrome/test/data/extensions/api_test/rtc_private/events/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..03dbfaa2afc2f5da17d23f1445784f96a026dcf8
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/rtc_private/events/background.js
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 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.
+
+var action_counter = 0;
+
+chrome.rtcPrivate.onLaunch.addListener(function(launchData) {
+ if(!launchData) {
+ console.log('HANDLER: got default action');
+ action_counter++;
+ return;
+ }
+
+ var action = launchData.intent.action;
+ if (action == 'chat' || action == 'video' || action == 'voice') {
+ console.log('HANDLER: Received ' + action +
+ ', data = ' + launchData.intent.data);
+ var data = launchData.intent.data;
+ var type = launchData.intent.type;
+ if (type != 'application/vnd.chromium.contact' ||
+ data.name != 'Test Contact' ||
+ data.phone.length != 2 ||
+ data.phone[0] != '(555) 111-2222' ||
+ data.phone[1] != '(555) 333-4444' ||
+ data.email.length != 2 ||
+ data.email[0] != 'test_1@something.com' ||
+ data.email[1] != 'test_2@something.com') {
+ chrome.test.fail('HANDLER: Invalid data!');
+ return;
+ }
+ action_counter++;
+ if (action_counter == 4)
+ chrome.test.sendMessage('received_all');
+ } else {
+ console.log('HANDLER: unknown action - ' + action);
+ chrome.test.fail('HANDLER: No content changed!');
+ return;
+ }
+});
+
+chrome.extension.onMessage.addListener(
+ function(request, sender, sendResponse) {
+ if (request.message == "getIntentsCount")
+ sendResponse({"count": action_counter});
+ });

Powered by Google App Engine
This is Rietveld 408576698