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

Unified Diff: remoting/webapp/crd/js/mock_client_plugin.js

Issue 1097133002: [Webapp Refactor] Remove remoting.SessionConnector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge conflicts Created 5 years, 8 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
« no previous file with comments | « remoting/webapp/crd/js/me2me_activity.js ('k') | remoting/webapp/crd/js/mock_session_connector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/mock_client_plugin.js
diff --git a/remoting/webapp/crd/js/mock_client_plugin.js b/remoting/webapp/crd/js/mock_client_plugin.js
index 965e213b171ed5275ebda48f32d1a1f0b2deacfc..698014749e2d0e5e195977956fcf362092f1fb72 100644
--- a/remoting/webapp/crd/js/mock_client_plugin.js
+++ b/remoting/webapp/crd/js/mock_client_plugin.js
@@ -5,7 +5,6 @@
/**
* @fileoverview
* Mock implementation of ClientPlugin for testing.
- * @suppress {checkTypes}
*/
'use strict';
@@ -20,12 +19,22 @@ var remoting = remoting || {};
*/
remoting.MockClientPlugin = function(container) {
this.container_ = container;
- this.element_ = document.createElement('div');
+ this.element_ = /** @type {HTMLElement} */ (document.createElement('div'));
this.element_.style.backgroundImage = 'linear-gradient(45deg, blue, red)';
- this.connectionStatusUpdateHandler_ = null;
- this.desktopSizeUpdateHandler_ = null;
this.container_.appendChild(this.element_);
this.hostDesktop_ = new remoting.MockClientPlugin.HostDesktop();
+ this.extensions_ = new remoting.ProtocolExtensionManager(base.doNothing);
+ /** @type {remoting.ClientPlugin.ConnectionEventHandler} */
+ this.connectionEventHandler = null;
+
+ // Fake initialization result to return.
+ this.mock$initializationResult = true;
+
+ // Fake capabilities to return.
+ this.mock$capabilities = [
+ remoting.ClientSession.Capability.SEND_INITIAL_RESOLUTION,
+ remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS
+ ];
};
remoting.MockClientPlugin.prototype.dispose = function() {
@@ -34,6 +43,10 @@ remoting.MockClientPlugin.prototype.dispose = function() {
this.connectionStatusUpdateHandler_ = null;
};
+remoting.MockClientPlugin.prototype.extensions = function() {
+ return this.extensions_;
+};
+
remoting.MockClientPlugin.prototype.hostDesktop = function() {
return this.hostDesktop_;
};
@@ -43,24 +56,31 @@ remoting.MockClientPlugin.prototype.element = function() {
};
remoting.MockClientPlugin.prototype.initialize = function(onDone) {
- window.setTimeout(onDone.bind(null, true), 0);
+ var that = this;
+ Promise.resolve().then(function() {
+ onDone(that.mock$initializationResult);
+ });
};
remoting.MockClientPlugin.prototype.connect =
function(host, localJid, credentialsProvider) {
- base.debug.assert(this.connectionStatusUpdateHandler_ != null);
- window.setTimeout(
- this.connectionStatusUpdateHandler_.bind(
- this,
+ base.debug.assert(this.connectionEventHandler !== null);
+ var that = this;
+ window.requestAnimationFrame(function() {
+ that.connectionEventHandler.onConnectionStatusUpdate(
remoting.ClientSession.State.CONNECTED,
- remoting.ClientSession.ConnectionError.NONE),
- 0);
+ remoting.ClientSession.ConnectionError.NONE);
+ });
};
+remoting.MockClientPlugin.prototype.injectKeyCombination = function(keys) {};
+
remoting.MockClientPlugin.prototype.injectKeyEvent =
function(key, down) {};
+remoting.MockClientPlugin.prototype.setRemapKeys = function(remappings) {};
+
remoting.MockClientPlugin.prototype.remapKey = function(from, to) {};
remoting.MockClientPlugin.prototype.releaseAllKeys = function() {};
@@ -75,12 +95,18 @@ remoting.MockClientPlugin.prototype.hasFeature = function(feature) {
return false;
};
+remoting.MockClientPlugin.prototype.hasCapability = function(capability) {
+ return this.mock$capabilities.indexOf(capability) !== -1;
+};
+
remoting.MockClientPlugin.prototype.sendClipboardItem =
function(mimeType, item) {};
remoting.MockClientPlugin.prototype.requestPairing =
function(clientName, onDone) {};
+remoting.MockClientPlugin.prototype.allowMouseLock = function() {};
+
remoting.MockClientPlugin.prototype.pauseAudio = function(pause) {};
remoting.MockClientPlugin.prototype.pauseVideo = function(pause) {};
@@ -97,41 +123,17 @@ remoting.MockClientPlugin.prototype.getPerfStats = function() {
return result;
};
-remoting.MockClientPlugin.prototype.sendClientMessage =
- function(name, data) {};
-
-remoting.MockClientPlugin.prototype.setOnOutgoingIqHandler =
- function(handler) {};
-
-remoting.MockClientPlugin.prototype.setOnDebugMessageHandler =
- function(handler) {};
-
-/**
- * @param {function(number, number):void} handler
- * @private
- */
-remoting.MockClientPlugin.prototype.setConnectionStatusUpdateHandler =
+remoting.MockClientPlugin.prototype.setConnectionEventHandler =
function(handler) {
- /** @type {function(number, number):void} */
- this.connectionStatusUpdateHandler_ = handler;
+ this.connetionEventHandler = handler;
};
-remoting.MockClientPlugin.prototype.setRouteChangedHandler =
- function(handler) {};
-
-remoting.MockClientPlugin.prototype.setConnectionReadyHandler =
- function(handler) {};
-
-remoting.MockClientPlugin.prototype.setCapabilitiesHandler =
- function(handler) {};
-
-remoting.MockClientPlugin.prototype.setGnubbyAuthHandler =
+remoting.MockClientPlugin.prototype.setMouseCursorHandler =
function(handler) {};
-remoting.MockClientPlugin.prototype.setCastExtensionHandler =
- function(handler) {};
+remoting.MockClientPlugin.prototype.setClipboardHandler = function(handler) {};
-remoting.MockClientPlugin.prototype.setMouseCursorHandler =
+remoting.MockClientPlugin.prototype.setDebugDirtyRegionHandler =
function(handler) {};
/**
@@ -192,13 +194,17 @@ remoting.MockClientPlugin.HostDesktop.prototype.resize =
/**
* @constructor
- * @extends {remoting.ClientPluginFactory}
+ * @implements {remoting.ClientPluginFactory}
*/
-remoting.MockClientPluginFactory = function() {};
+remoting.MockClientPluginFactory = function() {
+ /** @private {remoting.MockClientPlugin} */
+ this.plugin_ = null;
+};
remoting.MockClientPluginFactory.prototype.createPlugin =
function(container, onExtensionMessage) {
- return new remoting.MockClientPlugin(container);
+ this.plugin_ = new remoting.MockClientPlugin(container);
+ return this.plugin_;
};
remoting.MockClientPluginFactory.prototype.preloadPlugin = function() {};
« no previous file with comments | « remoting/webapp/crd/js/me2me_activity.js ('k') | remoting/webapp/crd/js/mock_session_connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698