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

Side by Side Diff: chrome/test/data/extensions/platform_apps/window_api_interactive/test.js

Issue 405323002: [Win Aero] Correctly set the minimum window size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add outer bounds test. Actually fix this. Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 var callbackPass = chrome.test.callbackPass; 5 var callbackPass = chrome.test.callbackPass;
6 6
7 function testWindowGetsFocus(win) { 7 function testWindowGetsFocus(win) {
8 // If the window is already focused, we are done. 8 // If the window is already focused, we are done.
9 if (win.contentWindow.document.hasFocus()) { 9 if (win.contentWindow.document.hasFocus()) {
10 chrome.test.assertTrue(win.contentWindow.document.hasFocus(), 10 chrome.test.assertTrue(win.contentWindow.document.hasFocus(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return; 42 return;
43 } 43 }
44 44
45 win.contentWindow.onload = callbackPass(function() { 45 win.contentWindow.onload = callbackPass(function() {
46 chrome.test.assertFalse(win.contentWindow.document.hasFocus(), 46 chrome.test.assertFalse(win.contentWindow.document.hasFocus(),
47 "window should not be focused"); 47 "window should not be focused");
48 win.close(); 48 win.close();
49 }); 49 });
50 } 50 }
51 51
52 // Test that the window's content size is the same as our inner bounds.
53 // This has to be an interactive test because contentWindow.innerWidth|Height is
54 // sometimes 0 in the browser test due to an unidentified race condition.
55 function testInnerBounds() {
56 chrome.test.runTests([
57 function create() {
58 chrome.app.window.create('test.html', {
59 //frame: {color: '#ff0000'},
benwells 2014/08/12 03:51:41 Ditto about the three tests.
jackhou1 2014/08/12 06:12:07 Done.
60 innerBounds: {
61 width: 300,
62 height: 301,
63 minWidth: 200,
64 minHeight: 201,
65 maxWidth: 400,
66 maxHeight: 401
67 }
68 }, callbackPass(function (win) {
69 chrome.test.assertEq(300, win.contentWindow.innerWidth);
70 chrome.test.assertEq(301, win.contentWindow.innerHeight);
71
72 chrome.test.assertEq(300, win.innerBounds.width);
73 chrome.test.assertEq(301, win.innerBounds.height);
74 chrome.test.assertEq(200, win.innerBounds.minWidth);
75 chrome.test.assertEq(201, win.innerBounds.minHeight);
76 chrome.test.assertEq(400, win.innerBounds.maxWidth);
77 chrome.test.assertEq(401, win.innerBounds.maxHeight);
78 }));
79 }
80 ]);
81 }
82
52 function testCreate() { 83 function testCreate() {
53 chrome.test.runTests([ 84 chrome.test.runTests([
54 function createUnfocusedWindow() { 85 function createUnfocusedWindow() {
55 chrome.app.window.create('test.html', { 86 chrome.app.window.create('test.html', {
56 innerBounds: { width: 200, height: 200 }, 87 innerBounds: { width: 200, height: 200 },
57 focused: false 88 focused: false
58 }, callbackPass(testWindowNeverGetsFocus)); 89 }, callbackPass(testWindowNeverGetsFocus));
59 }, 90 },
60 function createTwiceUnfocused() { 91 function createTwiceUnfocused() {
61 chrome.app.window.create('test.html', { 92 chrome.app.window.create('test.html', {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 })); 198 }));
168 }, 199 },
169 ]); 200 ]);
170 } 201 }
171 202
172 chrome.app.runtime.onLaunched.addListener(function() { 203 chrome.app.runtime.onLaunched.addListener(function() {
173 chrome.test.sendMessage('Launched', function(reply) { 204 chrome.test.sendMessage('Launched', function(reply) {
174 window[reply](); 205 window[reply]();
175 }); 206 });
176 }); 207 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698