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

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

Issue 14031021: Save and restore State for ShellWindows, including panels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add BaseWindow::GetRestoredState() Created 7 years, 8 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
Index: chrome/test/data/extensions/platform_apps/geometry/test.js
diff --git a/chrome/test/data/extensions/platform_apps/geometry/test.js b/chrome/test/data/extensions/platform_apps/geometry/test.js
index 17a188015b95a86505d62fceb1a03ab4be7da948..f7359f1a3b8477067895a3e3d6d1c3bcfb38c9b4 100644
--- a/chrome/test/data/extensions/platform_apps/geometry/test.js
+++ b/chrome/test/data/extensions/platform_apps/geometry/test.js
@@ -24,7 +24,10 @@ var testRestoreSize = function(id, frameType) {
win.setBounds(newBounds);
function boundsChanged() {
assertBoundsEqual(newBounds, win.getBounds());
+ win.onClosed.addListener(callbackPass(windowClosed));
win.close();
+ }
+ function windowClosed() {
chrome.app.window.create('empty.html',
{ id: id,
left: 113, top: 117, width: 314, height: 271,
@@ -35,6 +38,37 @@ var testRestoreSize = function(id, frameType) {
}));
}
+var assertState = function(win) {
+ if (win.id == 'normal') {
+ chrome.test.assertFalse(win.isMinimized());
+ chrome.test.assertFalse(win.isMaximized());
+ }
+ if (win.id == 'maximized') {
+ chrome.test.assertFalse(win.isMinimized());
+ chrome.test.assertTrue(win.isMaximized());
+ }
+}
+
+var testRestoreState = function(state_type) {
+ chrome.app.window.create(
+ 'empty.html',
+ { id: state_type, state: state_type },
+ callbackPass(windowCreated)
+ );
+ function windowCreated(win) {
+ assertState(win);
+ win.onClosed.addListener(callbackPass(windowClosed));
+ win.close();
+ function windowClosed() {
+ chrome.app.window.create(
+ 'empty.html',
+ { id: state_type },
+ function(win2) { assertState(win2); }
+ );
+ }
+ };
+}
+
chrome.app.runtime.onLaunched.addListener(function() {
chrome.test.runTests([
function testFramelessRestoreSize() {
@@ -43,5 +77,12 @@ chrome.app.runtime.onLaunched.addListener(function() {
function testFramedRestoreSize() {
testRestoreSize('framed', 'chrome');
},
+ function testRestoreNormal() {
+ testRestoreState('normal');
+ },
+ function testRestoreMaximized() {
+ testRestoreState('maximized');
+ },
+ // Minimize and fullscreen behavior are platform dependent.
]);
});

Powered by Google App Engine
This is Rietveld 408576698