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

Unified Diff: chrome/test/data/extensions/api_test/settings/managed_storage_events/background.js

Issue 10807086: Trigger chrome.storage.onChanged events for policy updates on the 'managed' namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, addressed comments, fixed ManagedStorageDisabled test Created 8 years, 5 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/settings/managed_storage_events/background.js
diff --git a/chrome/test/data/extensions/api_test/settings/managed_storage_events/background.js b/chrome/test/data/extensions/api_test/settings/managed_storage_events/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..538664cb0894680946b79b066f53aaa214d9b2b2
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/settings/managed_storage_events/background.js
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 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.
+
+chrome.test.runTests([
+ function managedChangeEvents() {
+ // Verify initial values.
+ chrome.storage.managed.get(
+ chrome.test.callbackPass(function(results) {
+ chrome.test.assertEq({
+ 'constant-policy': 'aaa',
+ 'changes-policy': 'bbb',
+ 'deleted-policy': 'ccc'
+ }, results);
+
+ // Now start listening for changes.
+ // chrome.test.listenOnce() adds and removes the listener to the
+ // given event, and only lets the test complete after receiving the
+ // event.
+ chrome.test.listenOnce(
+ chrome.storage.onChanged,
+ function(changes, namespace) {
+ chrome.test.assertEq('managed', namespace);
+ chrome.test.assertEq({
+ 'changes-policy': {
+ 'oldValue': 'bbb',
+ 'newValue': 'ddd'
+ },
+ 'deleted-policy': {
+ 'oldValue': 'ccc'
+ },
+ 'new-policy': {
+ 'newValue': 'eee'
+ }
+ }, changes);
+ });
+
+ // Signal to the browser that we're listening.
+ chrome.test.sendMessage('ready');
+ }));
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698