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

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

Issue 10659021: Move chrome.appWindow to chrome.app.window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 chrome.experimental.app.onLaunched.addListener(function() { 7 chrome.experimental.app.onLaunched.addListener(function() {
8 chrome.test.runTests([ 8 chrome.test.runTests([
9 function testCreateWindow() { 9 function testCreateWindow() {
10 chrome.appWindow.create('test.html', {}, callbackPass(function (win) { 10 chrome.app.window.create('test.html', {}, callbackPass(function (win) {
11 chrome.test.assertTrue(typeof win.window === 'object'); 11 chrome.test.assertTrue(typeof win.window === 'object');
12 chrome.test.assertEq('about:blank', win.location.href); 12 chrome.test.assertEq('about:blank', win.location.href);
13 chrome.test.assertEq('<html><head></head><body></body></html>', 13 chrome.test.assertEq('<html><head></head><body></body></html>',
14 win.document.documentElement.outerHTML); 14 win.document.documentElement.outerHTML);
15 })) 15 }))
16 }, 16 },
17 17
18 function testUpdateWindowWidth() { 18 function testUpdateWindowWidth() {
19 chrome.appWindow.create('test.html', 19 chrome.app.window.create('test.html',
20 {width:512, height:384, frame:'custom'}, 20 {width:512, height:384, frame:'custom'},
21 callbackPass(function(win) { 21 callbackPass(function(win) {
22 chrome.test.assertEq(512, win.innerWidth); 22 chrome.test.assertEq(512, win.innerWidth);
23 chrome.test.assertEq(384, win.innerHeight); 23 chrome.test.assertEq(384, win.innerHeight);
24 var oldWidth = win.outerWidth, oldHeight = win.outerHeight; 24 var oldWidth = win.outerWidth, oldHeight = win.outerHeight;
25 win.resizeBy(-256, 0); 25 win.resizeBy(-256, 0);
26 chrome.test.assertEq(oldWidth - 256, win.outerWidth); 26 chrome.test.assertEq(oldWidth - 256, win.outerWidth);
27 chrome.test.assertEq(oldHeight, win.outerHeight); 27 chrome.test.assertEq(oldHeight, win.outerHeight);
28 })); 28 }));
29 }, 29 },
30 30
31 /*function testMaximize() { 31 /*function testMaximize() {
32 chrome.appWindow.create('test.html', {width: 200, height: 200}, 32 chrome.app.window.create('test.html', {width: 200, height: 200},
33 callbackPass(function(win) { 33 callbackPass(function(win) {
34 win.onresize = callbackPass(function(e) { 34 win.onresize = callbackPass(function(e) {
35 // Crude test to check we're somewhat maximized. 35 // Crude test to check we're somewhat maximized.
36 chrome.test.assertTrue( 36 chrome.test.assertTrue(
37 win.outerHeight > screen.availHeight * 0.8); 37 win.outerHeight > screen.availHeight * 0.8);
38 chrome.test.assertTrue( 38 chrome.test.assertTrue(
39 win.outerWidth > screen.availWidth * 0.8); 39 win.outerWidth > screen.availWidth * 0.8);
40 }); 40 });
41 win.chrome.appWindow.maximize(); 41 win.chrome.app.window.maximize();
42 })); 42 }));
43 },*/ 43 },*/
44 44
45 /*function testRestore() { 45 /*function testRestore() {
46 chrome.appWindow.create('test.html', {width: 200, height: 200}, 46 chrome.app.window.create('test.html', {width: 200, height: 200},
47 callbackPass(function(win) { 47 callbackPass(function(win) {
48 var oldWidth = win.innerWidth; 48 var oldWidth = win.innerWidth;
49 var oldHeight = win.innerHeight; 49 var oldHeight = win.innerHeight;
50 win.onresize = callbackPass(function() { 50 win.onresize = callbackPass(function() {
51 chrome.test.assertTrue(win.innerWidth != oldWidth); 51 chrome.test.assertTrue(win.innerWidth != oldWidth);
52 chrome.test.assertTrue(win.innerHeight != oldHeight); 52 chrome.test.assertTrue(win.innerHeight != oldHeight);
53 // Seems like every time we resize, we get two resize events. 53 // Seems like every time we resize, we get two resize events.
54 // See http://crbug.com/133869. 54 // See http://crbug.com/133869.
55 win.onresize = callbackPass(function() { 55 win.onresize = callbackPass(function() {
56 // Ignore the immediately following resize, as it's a clone of 56 // Ignore the immediately following resize, as it's a clone of
57 // the one we just got. 57 // the one we just got.
58 win.onresize = callbackPass(function() { 58 win.onresize = callbackPass(function() {
59 chrome.test.assertEq(oldWidth, win.innerWidth); 59 chrome.test.assertEq(oldWidth, win.innerWidth);
60 chrome.test.assertEq(oldHeight, win.innerHeight); 60 chrome.test.assertEq(oldHeight, win.innerHeight);
61 }); 61 });
62 }) 62 })
63 win.chrome.appWindow.restore(); 63 win.chrome.app.window.restore();
64 }); 64 });
65 win.chrome.appWindow.maximize(); 65 win.chrome.app.window.maximize();
66 })); 66 }));
67 },*/ 67 },*/
68 ]); 68 ]);
69 }); 69 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698