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

Unified Diff: client/tests/client/dom/IndexedDB1Test.dart

Issue 10008031: Revert "First indexeddb test" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
« no previous file with comments | « client/tests/client/client.status ('k') | tools/testing/dart/browser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/client/dom/IndexedDB1Test.dart
diff --git a/client/tests/client/dom/IndexedDB1Test.dart b/client/tests/client/dom/IndexedDB1Test.dart
deleted file mode 100644
index f749a69204184af0ef1b69bbc3cccf0ea4787a9f..0000000000000000000000000000000000000000
--- a/client/tests/client/dom/IndexedDB1Test.dart
+++ /dev/null
@@ -1,132 +0,0 @@
-#library('IndexedDB1Test');
-#import('../../../../lib/unittest/unittest_dom.dart');
-#import('dart:dom');
-
-final String DB_NAME = 'Test';
-final String STORE_NAME = 'TEST';
-final String VERSION = '1';
-
-testReadWrite(key, value, check,
- [dbName = DB_NAME,
- storeName = STORE_NAME,
- version = VERSION]) => () {
- var db;
-
- fail(e) {
- callbackDone();
- Expect.fail('IndexedDB failure');
- }
-
- createObjectStore() {
- var store = db.createObjectStore(storeName);
- Expect.isNotNull(store);
- }
-
- step2() {
- var transaction = db.transaction(storeName, IDBTransaction.READ_ONLY);
- var request = transaction.objectStore(storeName).getObject(key);
- request.onsuccess = (e) {
- var object = e.target.result;
- check(value, object);
- callbackDone();
- };
- request.onerror = fail;
- }
-
- step1() {
- var transaction = db.transaction([storeName], IDBTransaction.READ_WRITE);
- var request = transaction.objectStore(storeName).put(value, key);
- request.onsuccess = (e) { step2(); };
- request.onerror = fail;
- }
-
- initDb(e) {
- db = e.target.result;
- if (version != db.version) {
- var request = db.setVersion(version);
- request.onsuccess = (e) { createObjectStore(); step1(); };
- request.onerror = fail;
- } else {
- step1();
- }
- }
-
- var request = window.webkitIndexedDB.open(dbName);
- Expect.isNotNull(request);
- request.onsuccess = initDb;
- request.onerror = fail;
-};
-
-testReadWriteTyped(key, value, check,
- [dbName = DB_NAME,
- storeName = STORE_NAME,
- version = VERSION]) => () {
- IDBDatabase db;
-
- fail(e) {
- callbackDone();
- Expect.fail('IndexedDB failure');
- }
-
- createObjectStore() {
- IDBObjectStore store = db.createObjectStore(storeName);
- Expect.isNotNull(store);
- }
-
- step2() {
- IDBTransaction transaction =
- db.transaction(storeName, IDBTransaction.READ_ONLY);
- IDBRequest request = transaction.objectStore(storeName).getObject(key);
- request.onsuccess = (e) {
- var object = e.target.result;
- check(value, object);
- callbackDone();
- };
- request.onerror = fail;
- }
-
- step1() {
- IDBTransaction transaction = db.transaction([storeName], IDBTransaction.READ_WRITE);
- IDBRequest request = transaction.objectStore(storeName).put(value, key);
- request.onsuccess = (e) { step2(); };
- request.onerror = fail;
- }
-
- initDb(e) {
- db = e.target.result;
- if (version != db.version) {
- IDBRequest request = db.setVersion(version);
- request.onsuccess = (e) { createObjectStore(); step1(); };
- request.onerror = fail;
- } else {
- step1();
- }
- }
-
- IDBRequest request = window.webkitIndexedDB.open(dbName);
- Expect.isNotNull(request);
- request.onsuccess = initDb;
- request.onerror = fail;
-};
-
-tests_dynamic() {
- asyncTest('test1', 1, testReadWrite(123, 'Hoot!', Expect.equals));
- asyncTest('test2', 1, testReadWrite(123, 12345, Expect.equals));
- asyncTest('test3', 1, testReadWrite(123, [1,2,3], Expect.listEquals));
- asyncTest('test4', 1, testReadWrite(123, const [2, 3, 4], Expect.listEquals));
-}
-
-tests_typed() {
- asyncTest('test1', 1, testReadWriteTyped(123, 'Hoot!', Expect.equals));
- asyncTest('test2', 1, testReadWriteTyped(123, 12345, Expect.equals));
- asyncTest('test3', 1, testReadWriteTyped(123, [1,2,3], Expect.listEquals));
- asyncTest('test4', 1,
- testReadWriteTyped(123, const [2, 3, 4], Expect.listEquals));
-}
-
-main() {
- forLayoutTests();
-
- tests_dynamic();
- tests_typed();
-}
« no previous file with comments | « client/tests/client/client.status ('k') | tools/testing/dart/browser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698