Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / permissions / optional_updates_bindings / background.js
blobfd9def135d39397621cc3f04177f19575339a355
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());
18 });
19 chrome.test.succeed();
20 });
21 });
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
26 // background page.
27 chrome.tabs.create({url: 'window.html'});