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

Unified Diff: remoting/webapp/base/js/viewport_unittest.js

Issue 1237763002: Support fractional desktopScale values in choosePluginDimensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/base/js/viewport.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/viewport_unittest.js
diff --git a/remoting/webapp/base/js/viewport_unittest.js b/remoting/webapp/base/js/viewport_unittest.js
index 71d9d88a9e056de0562c1dd1a43d60746e065bce..4bac8d35808222ca8245dce287b91f7876760961 100644
--- a/remoting/webapp/base/js/viewport_unittest.js
+++ b/remoting/webapp/base/js/viewport_unittest.js
@@ -326,4 +326,28 @@ QUnit.test('choosePluginSize() full-screen multi-monitor optimization',
assert.deepEqual(pluginSize, size(640 / 2.0, (2 * 480) / 2.0));
});
+QUnit.test('choosePluginSize() handling of desktopScale',
+ function(assert) {
+ // 1. Verify that a high-DPI client correctly up-scales the host to account
+ // for desktopScale.
+ var pluginSize = remoting.Viewport.choosePluginSize(
+ size(640, 480), 2.0, size(1.5 * 640, 1.5 * 480), dpi(96, 96), 1.5,
+ true, true);
+ assert.deepEqual(pluginSize, size(640, 480));
+
+ // 2. Verify that a high-DPI client correctly up-scales the host to fit
+ // if desktopScale would make it larger, but shrink-to-fit is set.
+ pluginSize = remoting.Viewport.choosePluginSize(
+ size(640, 480), 2.0, size(1280, 900), dpi(96, 96), 1.5,
+ true, true);
+ assert.deepEqual(pluginSize, size(640, 900 * (640 / 1280)));
+
+ // 3. Verify that a high-DPI client correctly up-scales the host based on
+ // desktopScale and shrink-to-fit is not set.
+ pluginSize = remoting.Viewport.choosePluginSize(
+ size(640, 480), 2.0, size(1280, 900), dpi(96, 96), 1.5,
+ true, false);
+ assert.deepEqual(pluginSize, size(1.5 * 1280, 1.5 * 900));
+});
+
})();
« no previous file with comments | « remoting/webapp/base/js/viewport.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698