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'); |
+ })); |
+ } |
+]); |