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

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

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/storage/background.js
===================================================================
--- chrome/test/data/extensions/api_test/storage/background.js (revision 0)
+++ chrome/test/data/extensions/api_test/storage/background.js (revision 0)
@@ -0,0 +1,42 @@
+// 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.
+
+// store some stuff in local storage
+localStorage.foo = "bar";
+
+console.log("Opening database...");
+// store some stuff in a database
+var db = window.openDatabase("mydb2", "1.0", "database test", 2048);
+if (!db)
+ chrome.test.notifyFail("failed to open database");
+
+console.log("Performing transaction...");
+db.transaction(function(tx) {
+ tx.executeSql("drop table if exists note", [], onDropSuccess, onSqlError);
+ tx.executeSql("create table note (body text)", [], onCreateSuccess, onSqlError);
+ tx.executeSql("insert into note values ('hotdog')", [], onSqlExecuted,
+ onSqlError);
+}, function(error) {
+ chrome.test.notifyFail(error.message);
+});
+
+function onDropSuccess(tx, res) {
+ console.log("note table dropped");
+}
+function onCreateSuccess(tx, res) {
+ console.log("note table created");
+}
+function onSqlError(tx, error) {
+ chrome.test.notifyFail(error.message);
+}
+function onSqlExecuted() {
+ console.log("Opening tab...");
+ // Open a tab. This doesn't really prove we're writing to disk, but it is
+ // difficult to prove that without shutting down the process. We'll just
+ // trust that if this next trick works, that the real testing for local
+ // storage is good enough to catch more subtle errors.
+ chrome.tabs.create({
+ url: "tab.html"
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698