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..6a646de30e806e0038e94355da95be9552be52cb 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,26 @@ remoting.MockClientPlugin.prototype.dispose = function() { |
this.connectionStatusUpdateHandler_ = null; |
}; |
+// TODO(kelvinp): Fix all call sites to use ClientPlugin.HostDesktop and remove |
+// the four methods below. |
remoting.MockClientPlugin.prototype.getDesktopWidth = function() { |
- return this.width_; |
+ return this.hostDesktop_.getDimensions().width; |
}; |
remoting.MockClientPlugin.prototype.getDesktopHeight = function() { |
- return this.height_; |
+ return this.hostDesktop_.getDimensions().height; |
}; |
remoting.MockClientPlugin.prototype.getDesktopXDpi = function() { |
- return 96; |
+ return this.hostDesktop_.getDimensions().xDpi; |
}; |
remoting.MockClientPlugin.prototype.getDesktopYDpi = function() { |
- return 96; |
+ return this.hostDesktop_.getDimensions().yDpi; |
+}; |
+ |
+remoting.MockClientPlugin.prototype.hostDesktop = function() { |
+ return this.hostDesktop_; |
}; |
remoting.MockClientPlugin.prototype.element = function() { |
@@ -80,8 +85,7 @@ remoting.MockClientPlugin.prototype.releaseAllKeys = function() {}; |
remoting.MockClientPlugin.prototype.notifyClientResolution = |
function(width, height, dpi) { |
- this.width_ = width; |
- this.height_ = height; |
+ this.hostDesktop_.resize(width, height, dpi); |
if (this.desktopSizeUpdateHandler_) { |
window.setTimeout(this.desktopSizeUpdateHandler_, 0); |
} |
@@ -169,6 +173,41 @@ remoting.MockClientPlugin.prototype.setFetchThirdPartyTokenHandler = |
remoting.MockClientPlugin.prototype.setFetchPinHandler = |
function(handler) {}; |
+remoting.MockClientPlugin.HostDesktop = function() { |
Jamie
2015/02/12 21:07:29
As with HostDesktopImpl, I don't think this needs
|
+ this.width_ = 0; |
+ this.height_ = 0; |
+ this.xDpi_ = 96; |
+ this.yDpi_ = 96; |
+ this.resizable_ = true; |
+ this.defineEvents(Object.keys(remoting.ClientPlugin.HostDesktop.Events)); |
+}; |
+base.extend(remoting.MockClientPlugin.HostDesktop, base.EventSourceImpl); |
+ |
+remoting.MockClientPlugin.HostDesktop.prototype.getDimensions = function() { |
+ return { |
+ width: this.width_, |
+ height: this.height_, |
+ xDpi: this.xDpi_, |
+ yDpi: this.yDpi_ |
+ }; |
+}; |
+ |
+remoting.MockClientPlugin.HostDesktop.prototype.isResizable = function() { |
+ return this.resizable_; |
+}; |
+ |
+remoting.MockClientPlugin.HostDesktop.prototype.hasResizeRateLimit = |
+ function() { |
+ return false; |
+ }; |
+ |
+remoting.MockClientPlugin.HostDesktop.prototype.resize = function( |
+ width, height, device_scale) { |
+ this.width_ = width; |
+ this.height_ = height; |
+ this.xDpi_ = this.yDpi_ = device_scale; |
+ this.raiseEvent(remoting.ClientPlugin.HostDesktop.Events.sizeChanged); |
+}; |
/** |
* @constructor |