Revert "Only store leading 13 bits of password hash."
[chromium-blink-merge.git] / chrome / test / data / extensions / platform_apps / windows_api_get / background.js
blob6f584a54dfb13a84bb4132d91353438551b8ad2a
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
3 // found in the LICENSE file.
5 function compareId(a, b) {
6 return a.id > b.id;
9 chrome.app.runtime.onLaunched.addListener(function() {
10 chrome.test.runTests([
12 function testGetAllNoWindows() {
13 chrome.test.assertEq({}, chrome.app.window.getAll());
14 chrome.test.succeed();
17 function testGetAllOneWindow() {
18 chrome.app.window.create('index.html', {id: 'win1'}, function(win) {
19 win.contentWindow.addEventListener('load', function() {
20 chrome.test.assertEq([win], chrome.app.window.getAll());
21 win.onClosed.addListener(function() {
22 chrome.test.succeed();
23 });
24 win.close();
25 });
26 });
29 function testGetAllMultipleWindows() {
30 chrome.app.window.create('index.html', {id: 'win1'}, function(win1) {
31 win1.contentWindow.addEventListener('load', function() {
32 chrome.app.window.create('index.html', {id: 'win2'}, function(win2) {
33 win2.contentWindow.addEventListener('load', function() {
34 var windows = chrome.app.window.getAll().sort(compareId);
35 chrome.test.assertEq([win1, win2], windows);
36 win2.onClosed.addListener(function() {
37 chrome.test.succeed();
38 });
39 win1.onClosed.addListener(function() {
40 win2.close();
41 });
42 win1.close();
43 });
44 });
45 });
46 });
49 function testGetNoWindows() {
50 chrome.test.assertEq(null, chrome.app.window.get(''));
51 chrome.test.succeed();
54 function testGet() {
55 chrome.app.window.create('index.html', {id: 'win1'}, function(win1) {
56 win1.contentWindow.addEventListener('load', function() {
57 chrome.app.window.create('index.html', {id: 'win2'}, function(win2) {
58 win2.contentWindow.addEventListener('load', function() {
59 chrome.test.assertEq(win1, chrome.app.window.get('win1'));
60 chrome.test.assertEq(win2, chrome.app.window.get('win2'));
61 chrome.test.assertEq(null, chrome.app.window.get('win3'));
62 win2.onClosed.addListener(function() {
63 chrome.test.succeed();
64 });
65 win1.onClosed.addListener(function() {
66 win2.close();
67 });
68 win1.close();
69 });
70 });
71 });
72 });
74 ]);
75 });