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

Unified Diff: chrome/test/data/extensions/api_test/settings/split_incognito/background.html

Issue 8762014: Move another set of extension tests to manifest_version 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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/split_incognito/background.html
===================================================================
--- chrome/test/data/extensions/api_test/settings/split_incognito/background.html (revision 112170)
+++ chrome/test/data/extensions/api_test/settings/split_incognito/background.html (working copy)
@@ -1,85 +1,6 @@
-<script>
-var api = chrome.experimental.storage;
-var assertEq = chrome.test.assertEq;
-var inIncognitoContext = chrome.extension.inIncognitoContext;
-
-['sync', 'local'].forEach(function(namespace) {
- api[namespace].notifications = [];
- api.onChanged.addListener(function(changes, event_namespace) {
- if (event_namespace == namespace) {
- changes.forEach(function(change) {
- api[namespace].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.
-// Each function accepts a callback which should be run when the settings
-// operation fully completes.
-var testActions = {
- noop: function(callback) {
- this.get("", callback);
- },
- assertEmpty: function(callback) {
- this.get(null, function(settings) {
- chrome.test.assertEq({}, settings);
- callback();
- });
- },
- assertFoo: function(callback) {
- this.get(null, function(settings) {
- chrome.test.assertEq({foo: "bar"}, settings);
- callback();
- });
- },
- setFoo: function(callback) {
- this.set({foo: "bar"}, callback);
- },
- removeFoo: function(callback) {
- this.remove("foo", callback);
- },
- clear: function(callback) {
- this.clear(callback);
- },
- assertNoNotifications: function(callback) {
- assertEq([], this.notifications);
- callback();
- },
- clearNotifications: function(callback) {
- this.notifications.length = 0;
- callback();
- },
- assertAddFooNotification: function(callback) {
- assertEq([{ key: 'foo', newValue: 'bar' }], this.notifications);
- callback();
- },
- assertDeleteFooNotification: function(callback) {
- assertEq([{ key: 'foo', oldValue: 'bar' }], this.notifications);
- callback();
- }
-};
-
-// The only test we run. Runs "actions" (as defined above) until told
-// to stop (when the message has isFinalAction set to true).
-function testEverything() {
- function next() {
- var waiting = inIncognitoContext ? "waiting_incognito" : "waiting";
- chrome.test.sendMessage(waiting, function(messageJson) {
- var message = JSON.parse(messageJson);
- var action = testActions[message.action];
- if (!action) {
- chrome.test.fail("Unknown action: " + message.action);
- return;
- }
- action.bind(api[message.namespace])(
- message.isFinalAction ? chrome.test.succeed : next);
- });
- }
- next();
-}
-
-chrome.test.runTests([testEverything]);
-</script>
+<!--
+ * Copyright (c) 2011 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.
+-->
+<script src="background.js"></script>

Powered by Google App Engine
This is Rietveld 408576698