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

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: Sync and rebase 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
« no previous file with comments | « chrome/test/data/extensions/platform_apps/outer_bounds/test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var innerBounds = {
57 width: 300,
58 height: 301,
59 minWidth: 200,
60 minHeight: 201,
61 maxWidth: 400,
62 maxHeight: 401
63 };
64
65 function assertInnerBounds(win) {
66 chrome.test.assertEq(300, win.contentWindow.innerWidth);
67 chrome.test.assertEq(301, win.contentWindow.innerHeight);
68
69 chrome.test.assertEq(300, win.innerBounds.width);
70 chrome.test.assertEq(301, win.innerBounds.height);
71 chrome.test.assertEq(200, win.innerBounds.minWidth);
72 chrome.test.assertEq(201, win.innerBounds.minHeight);
73 chrome.test.assertEq(400, win.innerBounds.maxWidth);
74 chrome.test.assertEq(401, win.innerBounds.maxHeight);
75 }
76
77 chrome.test.runTests([
78 function createFrameChrome() {
79 chrome.app.window.create('test.html', {
80 innerBounds: innerBounds
81 }, callbackPass(function (win) {
82 assertInnerBounds(win);
83 }));
84 },
85 function createFrameNone() {
86 chrome.app.window.create('test.html', {
87 frame: 'none',
88 innerBounds: innerBounds
89 }, callbackPass(function (win) {
90 assertInnerBounds(win);
91 }));
92 },
93 function createFrameColor() {
94 chrome.app.window.create('test.html', {
95 frame: {color: '#ff0000'},
96 innerBounds: innerBounds
97 }, callbackPass(function (win) {
98 assertInnerBounds(win);
99 }));
100 }
101 ]);
102 }
103
52 function testCreate() { 104 function testCreate() {
53 chrome.test.runTests([ 105 chrome.test.runTests([
54 function createUnfocusedWindow() { 106 function createUnfocusedWindow() {
55 chrome.app.window.create('test.html', { 107 chrome.app.window.create('test.html', {
56 innerBounds: { width: 200, height: 200 }, 108 innerBounds: { width: 200, height: 200 },
57 focused: false 109 focused: false
58 }, callbackPass(testWindowNeverGetsFocus)); 110 }, callbackPass(testWindowNeverGetsFocus));
59 }, 111 },
60 function createTwiceUnfocused() { 112 function createTwiceUnfocused() {
61 chrome.app.window.create('test.html', { 113 chrome.app.window.create('test.html', {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 })); 219 }));
168 }, 220 },
169 ]); 221 ]);
170 } 222 }
171 223
172 chrome.app.runtime.onLaunched.addListener(function() { 224 chrome.app.runtime.onLaunched.addListener(function() {
173 chrome.test.sendMessage('Launched', function(reply) { 225 chrome.test.sendMessage('Launched', function(reply) {
174 window[reply](); 226 window[reply]();
175 }); 227 });
176 }); 228 });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/outer_bounds/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698