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)); |
+}); |
+ |
})(); |