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

Unified Diff: chrome/test/data/extensions/api_test/gcd_private/api/session.js

Issue 411783002: Initial implementation of session APIs, sans WiFi component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/gcd_private/api/session.js
diff --git a/chrome/test/data/extensions/api_test/gcd_private/api/session.js b/chrome/test/data/extensions/api_test/gcd_private/api/session.js
new file mode 100644
index 0000000000000000000000000000000000000000..43f03153bfa226a7ab0d31e2fc0caab52f898d31
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/gcd_private/api/session.js
@@ -0,0 +1,33 @@
+// Copyright 2014 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.
+
+onload = function() {
+ chrome.test.runTests([
+ function session() {
+ function onConfirmCode(sessionId, status, code, method) {
+ chrome.test.assertEq("success", status);
+ chrome.test.assertEq("01234", code);
+ chrome.gcdPrivate.confirmCode(sessionId,
+ onSessionEstablished.bind(null,
+ sessionId));
+ }
+
+ function onSessionEstablished(sessionId, status) {
+ chrome.test.assertEq("success", status);
+
+ chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {},
+ onMessageSent);
+ }
+
+ function onMessageSent(status, output) {
+ chrome.test.assertEq("success", status);
+ chrome.test.assertEq("pong", output.response);
+
+ chrome.test.notifyPass();
+ }
+
+ chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onConfirmCode);
+ }
+ ]);
+};

Powered by Google App Engine
This is Rietveld 408576698