| 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);
|
| + }
|
| + ]);
|
| +};
|
|
|