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

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: Fixed use-after-free 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..df3febd957dd0ff91d8db043193711ae66da90e1
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/settings/managed_storage_events/background.js
@@ -0,0 +1,43 @@
+// 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(
+ null,
not at google - send to devlin 2012/07/25 00:49:02 can be left out entirely (new-ish code in schema_g
Joao da Silva 2012/07/25 12:52:13 Nice, done (also removed this in the other tests).
+ 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