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

Side by Side Diff: remoting/webapp/unittests/desktop_viewport_unittest.js

Issue 959963002: [Chromoting] Enable jscompile for webapp unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename sinon.$testStub -> sinon.TestStub Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 (function() {
6 6
7 'use strict'; 7 'use strict';
8 8
9 module('DesktopViewport'); 9 /**
10 10 * @param {number} width
11 * @param {number} height
12 * @return {{width:number, height:number}}
13 */
11 function size(width, height) { 14 function size(width, height) {
12 return {width: width, height: height}; 15 return {width: width, height: height};
13 } 16 }
14 17
18 /**
19 * @param {number} x
20 * @param {number} y
21 * @return {{x:number, y:number}}
22 */
15 function dpi(x, y) { 23 function dpi(x, y) {
16 return {x: x, y: y}; 24 return {x: x, y: y};
17 } 25 }
18 26
27 module('DesktopViewport');
28
19 test('choosePluginSize() handles low-DPI client & host', 29 test('choosePluginSize() handles low-DPI client & host',
20 function() { 30 function() {
21 // 1. Client & host size the same. 31 // 1. Client & host size the same.
22 var pluginSize = remoting.DesktopViewport.choosePluginSize( 32 var pluginSize = remoting.DesktopViewport.choosePluginSize(
23 size(640, 480), 1.0, size(640, 480), dpi(96, 96), 1.0, false, true); 33 size(640, 480), 1.0, size(640, 480), dpi(96, 96), 1.0, false, true);
24 QUnit.deepEqual(pluginSize, size(640, 480)); 34 QUnit.deepEqual(pluginSize, size(640, 480));
25 35
26 // 2. Client logical dimensions smaller than host's. 36 // 2. Client logical dimensions smaller than host's.
27 pluginSize = remoting.DesktopViewport.choosePluginSize( 37 pluginSize = remoting.DesktopViewport.choosePluginSize(
28 size(640, 480), 1.0, size(1024, 600), dpi(96, 96), 1.0, false, true); 38 size(640, 480), 1.0, size(1024, 600), dpi(96, 96), 1.0, false, true);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 320
311 // 8. Client & host per-monitor dimensions match, two monitors stacked, 321 // 8. Client & host per-monitor dimensions match, two monitors stacked,
312 // high-DPI client & host. 322 // high-DPI client & host.
313 pluginSize = remoting.DesktopViewport.choosePluginSize( 323 pluginSize = remoting.DesktopViewport.choosePluginSize(
314 size(640, 480), 2.0, size(640, 2 * 480), dpi(192, 192), 324 size(640, 480), 2.0, size(640, 2 * 480), dpi(192, 192),
315 1.0, true, true); 325 1.0, true, true);
316 QUnit.deepEqual(pluginSize, size(640 / 2.0, (2 * 480) / 2.0)); 326 QUnit.deepEqual(pluginSize, size(640 / 2.0, (2 * 480) / 2.0));
317 }); 327 });
318 328
319 })(); 329 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698