1 // Copyright 2015 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 // window.html will turn around and call this when it loads.
6 // |otherWindow| is its window object.
7 function runTest(otherWindow
) {
8 chrome
.test
.runWithUserGesture(function() {
9 chrome
.permissions
.request({permissions
: ['alarms']}, function(granted
) {
10 chrome
.test
.assertTrue(granted
);
11 // Assert that the bindings have been updated on ourselves the background
12 // page, and the tab that was created.
13 var expectedAlarmsKeys
= [
14 'clear', 'clearAll', 'create', 'get', 'getAll', 'onAlarm'];
15 [window
, otherWindow
].forEach(function(w
) {
16 chrome
.test
.assertEq(expectedAlarmsKeys
,
17 Object
.keys(w
.chrome
.alarms
).sort());
19 chrome
.test
.succeed();
24 // This is the important part; creating a new window would cause the optional
25 // pemissions to be updated on itself, rather than both the window and the
27 chrome
.tabs
.create({url
: 'window.html'});