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

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

Issue 9717011: Expose the chrome.windows.* API to platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable WindowsApi on Aura.x Created 8 years, 9 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/windows_api/main.js
diff --git a/chrome/test/data/extensions/platform_apps/windows_api/main.js b/chrome/test/data/extensions/platform_apps/windows_api/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..1ce9b3f9d19aa0ce9eba3e5a30a5c029285d4505
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/windows_api/main.js
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var callbackPass = chrome.test.callbackPass;
+
+// Only a few chrome.windows.* API methods are tested, it is assumed that the
+// full API is tested elsewhere.
+chrome.test.runTests([
+ function testGetCurrentWindow() {
+ chrome.windows.getCurrent(callbackPass(function(window) {
+ chrome.test.assertEq(250, window.width);
+ chrome.test.assertEq('shell', window.type);
+ }));
+ },
+
+ function testUpdateWindowWidth() {
+ chrome.windows.getCurrent(callbackPass(function(window) {
+ chrome.windows.update(
+ window.id, {width: 300}, callbackPass(function() {
+ // The timeout is rather lame, but reading back the width from the
+ // window manager (on Linux) immediately still reports the old
+ // value.
+ setTimeout(callbackPass(function() {
+ chrome.windows.getCurrent(callbackPass(function(window) {
+ chrome.test.assertEq(300, window.width);
+ }));
+ }), 100);
+ }));
+ }));
+ },
+
+ function testCreateWindow() {
+ var getShellWindowCount = function(callback) {
+ chrome.windows.getAll(function(windows) {
+ callback(windows.filter(
+ function(window) { return window.type == 'shell'}).length);
+ });
+ };
+
+ getShellWindowCount(callbackPass(function(shellWindowCount) {
+ chrome.test.assertEq(1, shellWindowCount);
+ chrome.windows.create({type: 'shell'}, callbackPass(function() {
+ getShellWindowCount(callbackPass(function(shellWindowCount) {
+ chrome.test.assertEq(2, shellWindowCount);
+ }));
+ }));
+ }));
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698