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..6c91f03ee8a0d50f363c4fe288f5099e85a0246d 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() { |
@@ -80,8 +67,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); |
} |
@@ -146,11 +132,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 +150,41 @@ remoting.MockClientPlugin.prototype.setFetchThirdPartyTokenHandler = |
remoting.MockClientPlugin.prototype.setFetchPinHandler = |
function(handler) {}; |
+remoting.MockClientPlugin.HostDesktop = function() { |
kelvinp
2015/02/18 02:31:51
Jamie: Although we don't run jscompile over this f
|
+ 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 |