Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8216)

Unified Diff: chrome/test/data/extensions/api_test/permissions/optional_updates_bindings/background.js

Issue 1142993002: Don't send unnecessary ExtensionMsg_Loaded IPCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: commnets Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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'});

Powered by Google App Engine
This is Rietveld 408576698