Index: remoting/webapp/browser_test/mock_client_plugin.js |
diff --git a/remoting/webapp/browser_test/mock_client_plugin.js b/remoting/webapp/browser_test/mock_client_plugin.js |
index e161a8f830b4facdb91563fd904d822a3b1c08df..3ad4d879b1b86383d4d9d76275a1932294b37cda 100644 |
--- a/remoting/webapp/browser_test/mock_client_plugin.js |
+++ b/remoting/webapp/browser_test/mock_client_plugin.js |
@@ -21,11 +21,10 @@ remoting.MockClientPlugin = function(container) { |
this.container_ = container; |
this.element_ = document.createElement('div'); |
this.element_.style.backgroundImage = 'linear-gradient(45deg, blue, red)'; |
- this.width_ = 640; |
- this.height_ = 480; |
this.connectionStatusUpdateHandler_ = null; |
this.desktopSizeUpdateHandler_ = null; |
this.container_.appendChild(this.element_); |
+ this.hostDesktop_ = new remoting.MockClientPlugin.HostDesktop(); |
}; |
remoting.MockClientPlugin.prototype.dispose = function() { |
@@ -34,20 +33,8 @@ remoting.MockClientPlugin.prototype.dispose = function() { |
this.connectionStatusUpdateHandler_ = null; |
}; |
-remoting.MockClientPlugin.prototype.getDesktopWidth = function() { |
- return this.width_; |
-}; |
- |
-remoting.MockClientPlugin.prototype.getDesktopHeight = function() { |
- return this.height_; |
-}; |
- |
-remoting.MockClientPlugin.prototype.getDesktopXDpi = function() { |
- return 96; |
-}; |
- |
-remoting.MockClientPlugin.prototype.getDesktopYDpi = function() { |
- return 96; |
+remoting.MockClientPlugin.prototype.hostDesktop = function() { |
+ return this.hostDesktop_; |
}; |
remoting.MockClientPlugin.prototype.element = function() { |
@@ -78,15 +65,6 @@ remoting.MockClientPlugin.prototype.remapKey = function(from, to) {}; |
remoting.MockClientPlugin.prototype.releaseAllKeys = function() {}; |
-remoting.MockClientPlugin.prototype.notifyClientResolution = |
- function(width, height, dpi) { |
- this.width_ = width; |
- this.height_ = height; |
- if (this.desktopSizeUpdateHandler_) { |
- window.setTimeout(this.desktopSizeUpdateHandler_, 0); |
- } |
-}; |
- |
remoting.MockClientPlugin.prototype.onIncomingIq = function(iq) {}; |
remoting.MockClientPlugin.prototype.isSupportedVersion = function() { |
@@ -146,11 +124,6 @@ remoting.MockClientPlugin.prototype.setRouteChangedHandler = |
remoting.MockClientPlugin.prototype.setConnectionReadyHandler = |
function(handler) {}; |
-remoting.MockClientPlugin.prototype.setDesktopSizeUpdateHandler = |
- function(handler) { |
- this.desktopSizeUpdateHandler_ = handler; |
-}; |
- |
remoting.MockClientPlugin.prototype.setCapabilitiesHandler = |
function(handler) {}; |
@@ -169,6 +142,68 @@ remoting.MockClientPlugin.prototype.setFetchThirdPartyTokenHandler = |
remoting.MockClientPlugin.prototype.setFetchPinHandler = |
function(handler) {}; |
+/** |
+ * @constructor |
+ * @implements {remoting.HostDesktop} |
+ */ |
+remoting.MockClientPlugin.HostDesktop = function() { |
+ /** @private */ |
+ this.width_ = 0; |
+ /** @private */ |
+ this.height_ = 0; |
+ /** @private */ |
+ this.xDpi_ = 96; |
+ /** @private */ |
+ this.yDpi_ = 96; |
+ /** @private */ |
+ this.resizable_ = true; |
+ this.defineEvents(Object.keys(remoting.ClientPlugin.HostDesktop.Events)); |
+}; |
+base.extend(remoting.MockClientPlugin.HostDesktop, base.EventSourceImpl); |
+ |
+/** |
+ * @return {{width:number, height:number, xDpi:number, yDpi:number}} |
+ * @override |
+ */ |
+remoting.MockClientPlugin.HostDesktop.prototype.getDimensions = function() { |
+ return { |
+ width: this.width_, |
+ height: this.height_, |
+ xDpi: this.xDpi_, |
+ yDpi: this.yDpi_ |
+ }; |
+}; |
+ |
+/** |
+ * @return {boolean} |
+ * @override |
+ */ |
+remoting.MockClientPlugin.HostDesktop.prototype.isResizable = function() { |
+ return this.resizable_; |
+}; |
+ |
+/** |
+ * @return {boolean} |
+ * @override |
+ */ |
+remoting.MockClientPlugin.HostDesktop.prototype.hasResizeRateLimit = |
+ function() { |
+ return false; |
Jamie
2015/02/18 23:06:19
Nit: Indentation.
kelvinp
2015/02/19 20:58:14
Done.
|
+ }; |
+ |
+/** |
+ * @param {number} width |
+ * @param {number} height |
+ * @param {number} dpi |
+ * @override |
+ */ |
+remoting.MockClientPlugin.HostDesktop.prototype.resize = function( |
+ width, height, device_scale) { |
Jamie
2015/02/18 23:06:19
s/device_scale/dpi/
kelvinp
2015/02/19 20:58:15
The parameter is about device scale (1.0) instead
|
+ this.width_ = width; |
+ this.height_ = height; |
+ this.xDpi_ = this.yDpi_ = device_scale; |
+ this.raiseEvent(remoting.ClientPlugin.HostDesktop.Events.sizeChanged); |
Jamie
2015/02/18 23:06:19
How does the event recipient know the new size? It
kelvinp
2015/02/19 20:58:15
Done. In order to hook this event, the client alr
|
+}; |
/** |
* @constructor |