dom/indexedDB/test/unit/test_open_empty_db.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /**
michael@0 2 * Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 4 */
michael@0 5
michael@0 6 var testGenerator = testSteps();
michael@0 7
michael@0 8 function testSteps()
michael@0 9 {
michael@0 10 const names = [
michael@0 11 //"",
michael@0 12 null,
michael@0 13 undefined,
michael@0 14 this.window ? window.location.pathname : "Splendid Test"
michael@0 15 ];
michael@0 16
michael@0 17 const version = 1;
michael@0 18
michael@0 19 for each (let name in names) {
michael@0 20 let request = indexedDB.open(name, version);
michael@0 21 request.onerror = errorHandler;
michael@0 22 request.onsuccess = grabEventAndContinueHandler;
michael@0 23 let event = yield undefined;
michael@0 24
michael@0 25 if (name === null) {
michael@0 26 name = "null";
michael@0 27 }
michael@0 28 else if (name === undefined) {
michael@0 29 name = "undefined";
michael@0 30 }
michael@0 31
michael@0 32 let db = event.target.result;
michael@0 33 is(db.name, name, "Bad name");
michael@0 34 is(db.version, version, "Bad version");
michael@0 35 is(db.objectStoreNames.length, 0, "Bad objectStores list");
michael@0 36
michael@0 37 is(db.name, request.result.name, "Bad name");
michael@0 38 is(db.version, request.result.version, "Bad version");
michael@0 39 is(db.objectStoreNames.length, request.result.objectStoreNames.length,
michael@0 40 "Bad objectStores list");
michael@0 41 }
michael@0 42
michael@0 43 finishTest();
michael@0 44 yield undefined;
michael@0 45 }
michael@0 46

mercurial