Index: chrome/test/data/extensions/platform_apps/windows_api_always_on_top/background.js |
diff --git a/chrome/test/data/extensions/platform_apps/windows_api_always_on_top/background.js b/chrome/test/data/extensions/platform_apps/windows_api_always_on_top/background.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f89a25e6e9ac1a09c4256d8aadba1326a4beb329 |
--- /dev/null |
+++ b/chrome/test/data/extensions/platform_apps/windows_api_always_on_top/background.js |
@@ -0,0 +1,42 @@ |
+// Copyright 2013 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; |
+ |
+function testAlwaysOnTop(testId, initValue) { |
+ var options = |
+ { |
+ id: testId, |
+ alwaysOnTop: initValue |
+ }; |
+ chrome.app.window.create('index.html', |
+ options, |
+ callbackPass(function(win) { |
+ chrome.test.assertEq(initValue, win.isAlwaysOnTop()); |
+ win.setAlwaysOnTop(!initValue); |
+ |
+ setTimeout(callbackPass(function() { |
benwells
2013/10/09 02:00:50
Is there any way to test this without relying on a
tmdiep
2013/10/09 06:18:08
It is tricky to test whether the window is actuall
|
+ chrome.test.assertEq(!initValue, win.isAlwaysOnTop()); |
+ win.contentWindow.close(); |
+ }), 500); |
+ })); |
+} |
+ |
+chrome.app.runtime.onLaunched.addListener(function() { |
+ chrome.test.runTests([ |
+ |
+ // Window is created with always on top enabled, then disabled after |
+ // creation. |
+ function testAlwaysOnTopInitTrue() { |
+ testAlwaysOnTop('testAlwaysOnTopInitTrue', true); |
+ }, |
+ |
+ // Window is created with always on top disabled, then enabled after |
+ // creation. |
+ function testAlwaysOnTopInitFalse() { |
+ testAlwaysOnTop('testAlwaysOnTopInitFalse', false); |
+ } |
+ |
+ ]); |
+}); |