| Index: chrome/test/data/extensions/api_test/permissions/optional_updates_bindings/background.js
|
| diff --git a/chrome/test/data/extensions/api_test/permissions/optional_updates_bindings/background.js b/chrome/test/data/extensions/api_test/permissions/optional_updates_bindings/background.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fd9def135d39397621cc3f04177f19575339a355
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/permissions/optional_updates_bindings/background.js
|
| @@ -0,0 +1,27 @@
|
| +// Copyright 2015 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.
|
| +
|
| +// window.html will turn around and call this when it loads.
|
| +// |otherWindow| is its window object.
|
| +function runTest(otherWindow) {
|
| + chrome.test.runWithUserGesture(function() {
|
| + chrome.permissions.request({permissions: ['alarms']}, function(granted) {
|
| + chrome.test.assertTrue(granted);
|
| + // Assert that the bindings have been updated on ourselves the background
|
| + // page, and the tab that was created.
|
| + var expectedAlarmsKeys = [
|
| + 'clear', 'clearAll', 'create', 'get', 'getAll', 'onAlarm'];
|
| + [window, otherWindow].forEach(function(w) {
|
| + chrome.test.assertEq(expectedAlarmsKeys,
|
| + Object.keys(w.chrome.alarms).sort());
|
| + });
|
| + chrome.test.succeed();
|
| + });
|
| + });
|
| +}
|
| +
|
| +// This is the important part; creating a new window would cause the optional
|
| +// pemissions to be updated on itself, rather than both the window and the
|
| +// background page.
|
| +chrome.tabs.create({url: 'window.html'});
|
|
|