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

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

Issue 918783002: CRD Viewport Management refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + plumbing remoting.Host into clientSession 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/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() {
Jamie 2015/02/18 00:33:10 Although we don't run jscompile over this file, it
+ 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

Powered by Google App Engine
This is Rietveld 408576698