| OLD | NEW |
| 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 var callbackFail = chrome.test.callbackFail; | 6 var callbackFail = chrome.test.callbackFail; |
| 7 var defaultFuzzFactor = 1; | 7 var defaultFuzzFactor = 1; |
| 8 | 8 |
| 9 function assertFuzzyEq(expected, actual, fuzzFactor, message) { | 9 function assertFuzzyEq(expected, actual, fuzzFactor, message) { |
| 10 if (!message) { | 10 if (!message) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 typeof win.contentWindow.document !== 'undefined'); | 211 typeof win.contentWindow.document !== 'undefined'); |
| 212 chrome.test.assertFalse( | 212 chrome.test.assertFalse( |
| 213 'about:blank' === win.contentWindow.location.href); | 213 'about:blank' === win.contentWindow.location.href); |
| 214 var cw = win.contentWindow.chrome.app.window.current(); | 214 var cw = win.contentWindow.chrome.app.window.current(); |
| 215 chrome.test.assertEq(cw, win); | 215 chrome.test.assertEq(cw, win); |
| 216 chrome.test.assertEq('testId', cw.id); | 216 chrome.test.assertEq('testId', cw.id); |
| 217 win.contentWindow.close(); | 217 win.contentWindow.close(); |
| 218 })) | 218 })) |
| 219 }, | 219 }, |
| 220 | 220 |
| 221 function badWindow() { | |
| 222 chrome.app.window.create('404.html', callbackPass(function(win) { | |
| 223 chrome.test.assertTrue(typeof win === 'undefined'); | |
| 224 // TODO(mlamouri): because |win| is not defined, we can not close that | |
| 225 // window... | |
| 226 })); | |
| 227 }, | |
| 228 | |
| 229 function loadEvent() { | 221 function loadEvent() { |
| 230 chrome.app.window.create('test.html', callbackPass(function(win) { | 222 chrome.app.window.create('test.html', callbackPass(function(win) { |
| 231 win.contentWindow.onload = callbackPass(function() { | 223 win.contentWindow.onload = callbackPass(function() { |
| 232 chrome.test.assertEq(document.readyState, 'complete'); | 224 chrome.test.assertEq(document.readyState, 'complete'); |
| 233 win.contentWindow.close(); | 225 win.contentWindow.close(); |
| 234 }); | 226 }); |
| 235 })); | 227 })); |
| 236 }, | 228 }, |
| 237 | 229 |
| 238 function multiWindow() { | 230 function multiWindow() { |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 })); | 1401 })); |
| 1410 }, | 1402 }, |
| 1411 ]); | 1403 ]); |
| 1412 } | 1404 } |
| 1413 | 1405 |
| 1414 chrome.app.runtime.onLaunched.addListener(function() { | 1406 chrome.app.runtime.onLaunched.addListener(function() { |
| 1415 chrome.test.sendMessage('Launched', function(reply) { | 1407 chrome.test.sendMessage('Launched', function(reply) { |
| 1416 window[reply](); | 1408 window[reply](); |
| 1417 }); | 1409 }); |
| 1418 }); | 1410 }); |
| OLD | NEW |