| Index: chrome/test/data/extensions/api_test/settings/split_incognito/background.html
|
| diff --git a/chrome/test/data/extensions/api_test/settings/split_incognito/background.html b/chrome/test/data/extensions/api_test/settings/split_incognito/background.html
|
| index 1a8fb7bab04d6a499a9aae06143600ddf42e0a0e..33aa64cacb05cac03b1d8ef5962c474221687b03 100644
|
| --- a/chrome/test/data/extensions/api_test/settings/split_incognito/background.html
|
| +++ b/chrome/test/data/extensions/api_test/settings/split_incognito/background.html
|
| @@ -1,10 +1,7 @@
|
| <script>
|
|
|
| var settings = chrome.experimental.settings;
|
| -
|
| -// A different "waiting" message depending on whether this background page runs
|
| -// in incognito mode or not. This is so that the C++ test can differentiate
|
| -// between messages.
|
| +var assertEq = chrome.test.assertEq;
|
|
|
| // Returns a function that asserts a result is expected.
|
| function assertResultEq(expected) {
|
| @@ -13,6 +10,14 @@ function assertResultEq(expected) {
|
| };
|
| }
|
|
|
| +// All notifications received.
|
| +var notifications = [];
|
| +settings.onChanged.addListener(function(changes) {
|
| + changes.forEach(function(change) {
|
| + notifications.push(change);
|
| + });
|
| +});
|
| +
|
| // The test from C++ runs "actions", where each action is defined here.
|
| // This allows the test to be tightly controlled between incognito and
|
| // non-incognito modes.
|
| @@ -23,10 +28,10 @@ var testActions = {
|
| assertEmpty: function() {
|
| settings.get(null, assertResultEq({}));
|
| },
|
| - assertFoobar: function() {
|
| + assertFoo: function() {
|
| settings.get(null, assertResultEq({foo: "bar"}));
|
| },
|
| - setFoobar: function() {
|
| + setFoo: function() {
|
| settings.set({foo: "bar"}, assertResultEq({foo: "bar"}));
|
| },
|
| removeFoo: function() {
|
| @@ -34,6 +39,24 @@ var testActions = {
|
| },
|
| clear: function() {
|
| settings.clear(assertResultEq(undefined));
|
| + },
|
| + assertNoNotifications: function() {
|
| + assertEq([], notifications);
|
| + },
|
| + clearNotifications: function() {
|
| + notifications = [];
|
| + },
|
| + assertAddFooNotification: function() {
|
| + assertEq(1, notifications.length);
|
| + assertEq("foo", notifications[0].key);
|
| + assertEq(undefined, notifications[0].oldValue);
|
| + assertEq("bar", notifications[0].newValue);
|
| + },
|
| + assertDeleteFooNotification: function() {
|
| + assertEq(1, notifications.length);
|
| + assertEq("foo", notifications[0].key);
|
| + assertEq("bar", notifications[0].oldValue);
|
| + assertEq(undefined, notifications[0].newValue);
|
| }
|
| };
|
|
|
|
|