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

Unified Diff: chrome/test/data/extensions/platform_apps/windows_api/test.js

Issue 10910304: Cache the object given to the chrome.app.window.create callback (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/resources/extensions/app_window_custom_bindings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/platform_apps/windows_api/test.js
diff --git a/chrome/test/data/extensions/platform_apps/windows_api/test.js b/chrome/test/data/extensions/platform_apps/windows_api/test.js
index 889c96dc4b3a47404743935c4116ad4fa020a98c..cd178dab970905cdea9fb9cb7e34d4ea545fe2e5 100644
--- a/chrome/test/data/extensions/platform_apps/windows_api/test.js
+++ b/chrome/test/data/extensions/platform_apps/windows_api/test.js
@@ -7,12 +7,36 @@ var callbackPass = chrome.test.callbackPass;
chrome.app.runtime.onLaunched.addListener(function() {
chrome.test.runTests([
function testCreateWindow() {
- chrome.app.window.create('test.html', {}, callbackPass(function (win) {
+ chrome.app.window.create('test.html',
+ {id: 'testId'},
+ callbackPass(function (win) {
chrome.test.assertTrue(typeof win.contentWindow.window === 'object');
chrome.test.assertEq('about:blank', win.contentWindow.location.href);
chrome.test.assertEq('<html><head></head><body></body></html>',
win.contentWindow.document.documentElement.outerHTML);
- }))
+ var cw = win.contentWindow.chrome.app.window.current();
+ chrome.test.assertEq(cw, win);
+ chrome.test.assertEq('testId', cw.id);
+ }));
+ },
+
+ function testCreateMultiWindow() {
+ chrome.test.assertTrue(null === chrome.app.window.current());
+ chrome.app.window.create('test.html',
+ {id: 'testId1'},
+ callbackPass(function (win1) {
+ chrome.app.window.create('test.html',
+ {id: 'testId2'},
+ callbackPass(function (win2) {
+ var cw1 = win1.contentWindow.chrome.app.window.current();
+ var cw2 = win2.contentWindow.chrome.app.window.current();
+ chrome.test.assertEq('testId1', cw1.id);
+ chrome.test.assertEq('testId2', cw2.id);
+ chrome.test.assertTrue(cw1 === win1);
+ chrome.test.assertTrue(cw2 === win2);
+ chrome.test.assertFalse(cw1 === cw2);
+ }));
+ }));
},
function testUpdateWindowWidth() {
« no previous file with comments | « chrome/renderer/resources/extensions/app_window_custom_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698