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

Unified Diff: remoting/webapp/unittests/it2me_helper_channel_unittest.js

Issue 973333002: Remove Hangout Remote Desktop integration code from the webapp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + manifest changes 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 side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/unittests/it2me_helper_channel_unittest.js
diff --git a/remoting/webapp/unittests/it2me_helper_channel_unittest.js b/remoting/webapp/unittests/it2me_helper_channel_unittest.js
deleted file mode 100644
index aa25693f16f24844227db75247716ff4d5124b3f..0000000000000000000000000000000000000000
--- a/remoting/webapp/unittests/it2me_helper_channel_unittest.js
+++ /dev/null
@@ -1,194 +0,0 @@
-// 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.
-
-/**
- * @fileoverview
- * @suppress {checkTypes|checkVars|reportUnknownTypes|visibility}
- */
-
-(function() {
-
-'use strict';
-
-var appLauncher = null;
-var hangoutPort = null;
-var webappPort = null;
-var helperChannel = null;
-var disconnectCallback = null;
-
-module('It2MeHelperChannel', {
- setup: function() {
- // App Launcher.
- appLauncher = {
- launch: function () {
- return promiseResolveSynchronous('tabId');
- },
- close: function () {}
- };
- appLauncher.launch = sinon.spy(appLauncher, 'launch');
- appLauncher.close = sinon.spy(appLauncher, 'close');
-
- // HangoutPort.
- hangoutPort = new chromeMocks.runtime.Port();
- hangoutPort.postMessage = sinon.spy(hangoutPort, 'postMessage');
- hangoutPort.disconnect = sinon.spy(hangoutPort, 'disconnect');
-
- // WebappPort.
- webappPort = new chromeMocks.runtime.Port();
- webappPort.sender = {
- tab : {
- id : 'tabId'
- }
- };
- webappPort.postMessage = sinon.spy(webappPort, 'postMessage');
- webappPort.disconnect = sinon.spy(webappPort, 'disconnect');
-
- // disconnect callback
- disconnectCallback = sinon.spy();
-
- // HelperChannel.
- helperChannel = new remoting.It2MeHelperChannel(
- appLauncher, hangoutPort, disconnectCallback);
- helperChannel.init();
- hangoutPort.onMessage.mock$fire({
- method: remoting.It2MeHelperChannel.HangoutMessageTypes.CONNECT,
- accessCode: "123412341234"
- });
- },
-});
-
-function promiseResolveSynchronous(value) {
- return {
- then: function(callback) {
- callback('tabId');
- }
- };
-}
-
-test('onHangoutMessage_("hello") should return supportedFeatures', function() {
- hangoutPort.onMessage.mock$fire(
- { method: remoting.It2MeHelperChannel.HangoutMessageTypes.HELLO });
-
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method: remoting.It2MeHelperChannel.HangoutMessageTypes.HELLO_RESPONSE,
- supportedFeatures: base.values(remoting.It2MeHelperChannel.Features)
- });
-});
-
-test('onHangoutMessage_(|connect|) should launch the webapp',
- function() {
- sinon.assert.called(appLauncher.launch);
- QUnit.equal(helperChannel.instanceId(), 'tabId');
-});
-
-test('onWebappMessage() should forward messages to hangout', function() {
- // Execute.
- helperChannel.onWebappConnect(webappPort);
- webappPort.onMessage.mock$fire({
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CONNECTING
- });
- webappPort.onMessage.mock$fire({
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CONNECTED
- });
-
- // Verify events are forwarded.
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CONNECTING
- });
-
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CONNECTED
- });
-});
-
-test('should notify hangout when the webapp crashes', function() {
- // Execute.
- helperChannel.onWebappConnect(webappPort);
- webappPort.onDisconnect.mock$fire();
-
- // Verify events are forwarded.
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method:'sessionStateChanged',
- state: remoting.ClientSession.State.FAILED
- });
- sinon.assert.called(hangoutPort.disconnect);
- sinon.assert.calledOnce(disconnectCallback);
-});
-
-test('should notify hangout when the session is ended', function() {
- // Execute.
- helperChannel.onWebappConnect(webappPort);
- webappPort.onMessage.mock$fire({
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CLOSED
- });
-
- webappPort.onDisconnect.mock$fire();
-
- // Verify events are forwarded.
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CLOSED
- });
- sinon.assert.called(hangoutPort.disconnect);
- sinon.assert.calledOnce(disconnectCallback);
-});
-
-test('should notify hangout when the session has error', function() {
- helperChannel.onWebappConnect(webappPort);
- webappPort.onMessage.mock$fire({
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.FAILED
- });
-
- webappPort.onDisconnect.mock$fire();
-
- // Verify events are forwarded.
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.FAILED
- });
- sinon.assert.called(hangoutPort.disconnect);
- sinon.assert.calledOnce(disconnectCallback);
-});
-
-
-test('onHangoutMessages_(disconnect) should close the webapp', function() {
- // Execute.
- helperChannel.onWebappConnect(webappPort);
- hangoutPort.onMessage.mock$fire({
- method: remoting.It2MeHelperChannel.HangoutMessageTypes.DISCONNECT
- });
-
- sinon.assert.calledOnce(appLauncher.close);
-
- // Webapp will respond by disconnecting the port
- webappPort.onDisconnect.mock$fire();
-
- // Verify events are forwarded.
- sinon.assert.calledWith(hangoutPort.postMessage, {
- method:'sessionStateChanged',
- state:remoting.ClientSession.State.CLOSED
- });
- sinon.assert.called(webappPort.disconnect);
- sinon.assert.called(hangoutPort.disconnect);
-});
-
-test('should close the webapp when hangout crashes', function() {
- // Execute.
- helperChannel.onWebappConnect(webappPort);
- hangoutPort.onDisconnect.mock$fire();
-
- sinon.assert.calledOnce(appLauncher.close);
- sinon.assert.calledOnce(disconnectCallback);
-
- sinon.assert.called(hangoutPort.disconnect);
- sinon.assert.called(webappPort.disconnect);
-});
-
-})();
« no previous file with comments | « remoting/webapp/unittests/it2me_helpee_channel_unittest.js ('k') | remoting/webapp/unittests/it2me_service_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698