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

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

Issue 877613002: Added pairing with Spake SHA224 key exchange. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@brillo1
Patch Set: Thu Jan 29 23:44:10 PST 2015 Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 onload = function() { 5 onload = function() {
6 chrome.test.runTests([ 6 chrome.test.runTests([
7 function session() { 7 function session() {
8 function onSessionEstablished(sessionId, status, pairingTypes) { 8 function onSessionEstablished(sessionId, status, pairingTypes) {
9 chrome.test.assertEq("success", status); 9 chrome.test.assertEq("success", status);
10 chrome.test.assertEq(["embeddedCode"], pairingTypes); 10 chrome.test.assertEq(["embeddedCode"], pairingTypes);
11 chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {}, 11 chrome.gcdPrivate.startPairing(1234, "pinCode",
12 onMessageSentFail); 12 onPairingStarted.bind(null));
13 chrome.gcdPrivate.startPairing(sessionId, "embeddedCode",
14 onPairingStarted.bind(null, sessionId));
15 } 13 }
16 14
17 function onPairingStarted(sessionId, status) { 15 function onPairingStarted(status) {
18 chrome.test.assertEq("success", status); 16 chrome.test.assertEq("unknownSessionError", status);
19 chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {}, 17 chrome.gcdPrivate.confirmCode(7567, "1234",
20 onMessageSentFail); 18 onCodeConfirmed.bind(null));
21 chrome.gcdPrivate.confirmCode(sessionId, "1234",
22 onCodeConfirmed.bind(null, sessionId));
23 } 19 }
24 20
25 function onCodeConfirmed(sessionId, status) { 21 function onCodeConfirmed(status) {
26 chrome.test.assertEq("success", status); 22 chrome.test.assertEq("unknownSessionError", status);
27 chrome.gcdPrivate.sendMessage(sessionId, "/privet/ping", {}, 23 chrome.gcdPrivate.sendMessage(555, "/privet/ping", {},
28 onMessageSent); 24 onMessageSent);
29 } 25 }
30 26
31 function onMessageSentFail(status, output) {
32 chrome.test.assertEq("sessionError", status);
33 }
34
35 function onMessageSent(status, output) { 27 function onMessageSent(status, output) {
36 chrome.test.assertEq("success", status); 28 chrome.test.assertEq("unknownSessionError", status);
37 chrome.test.assertEq("pong", output.response);
38 chrome.test.notifyPass(); 29 chrome.test.notifyPass();
39 } 30 }
40 31
41 chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onSessionEstablished); 32 chrome.gcdPrivate.establishSession("1.2.3.4", 9090, onSessionEstablished);
42 } 33 }
43 ]); 34 ]);
44 }; 35 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698