Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IndexedDB: Delete the Opera-ported Microsoft IDB tests
and resurrect the rewritten tests
- Loading branch information
Showing
223 changed files
with
3,831 additions
and
9,698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>IndexedDB inside of a WebWorker </title> | ||
<script type="text/javascript" src="support.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="text/javascript"> | ||
var t = async_test(); | ||
<title>IndexedDB inside of a WebWorker </title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support.js"></script> | ||
|
||
function RunTest() { | ||
var worker = new Worker("idbworker.js"); | ||
worker.onmessage = t.step_func( function (event) { | ||
assert_equals(event.data, true, 'self.indexedDB'); | ||
t.done(); | ||
}); | ||
worker.postMessage(1); | ||
} | ||
|
||
t.step( RunTest ); | ||
<script> | ||
var db, count = 0, | ||
t = async_test(); | ||
|
||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
</body> | ||
</html> | ||
t.step(function() { | ||
var worker = new Worker("idbworker.js"); | ||
worker.onmessage = t.step_func(function (e) { | ||
switch(count) { | ||
case 0: | ||
assert_equals(e.data, true, 'worker has idb object') | ||
break | ||
|
||
case 1: | ||
assert_equals(e.data, "test", "get(1) in worker") | ||
t.done() | ||
} | ||
|
||
count++ | ||
}); | ||
|
||
worker.postMessage(1); | ||
}) | ||
|
||
</script> | ||
|
||
<div id="log"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,56 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title> IDBCursor.advance() - index - iterate cursor number of times specified by count </title> | ||
<script type="text/javascript" src="support.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="text/javascript"> | ||
var objectStoreName = "objectstore"; | ||
var indexName = "index"; | ||
var records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" }, | ||
{ pKey: "primaryKey_1", iKey: "indexKey_1" }, | ||
{ pKey: "primaryKey_2", iKey: "indexKey_2" }, | ||
{ pKey: "primaryKey_3", iKey: "indexKey_3" }]; | ||
var count = 0; | ||
var db = null; | ||
var t = async_test(); | ||
|
||
function RunTest() { | ||
var rqOpen = window.indexedDB.open(databaseName, databaseVersion); | ||
rqOpen.onupgradeneeded = t.step_func( function(event) { | ||
db = event.target.result; | ||
db.onerror = t.step_func( assert_database_error ); | ||
var objStore = db.createObjectStore(objectStoreName, {keyPath:"pKey"}); | ||
objStore.createIndex(indexName, "iKey"); | ||
for(var i = 0; i < records.length; i++) { | ||
objStore.add(records[i]); | ||
} | ||
}); | ||
rqOpen.onsuccess = t.step_func(VerifyCursorIterates); | ||
rqOpen.onerror = t.step_func( assert_open_request_error ); | ||
<title>IDBCursor.advance() - index - iterate cursor number of times specified by count </title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src=support.js></script> | ||
|
||
<script> | ||
var db, | ||
count = 0, | ||
t = async_test(), | ||
records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" }, | ||
{ pKey: "primaryKey_1", iKey: "indexKey_1" }, | ||
{ pKey: "primaryKey_2", iKey: "indexKey_2" }, | ||
{ pKey: "primaryKey_3", iKey: "indexKey_3" }]; | ||
|
||
var open_rq = createdb(t); | ||
open_rq.onupgradeneeded = function(e) { | ||
db = event.target.result; | ||
var store = db.createObjectStore("test", {keyPath:"pKey"}); | ||
store.createIndex("idx", "iKey"); | ||
|
||
for(var i = 0; i < records.length; i++) { | ||
store.add(records[i]); | ||
} | ||
|
||
function VerifyCursorIterates() { | ||
var txn = db.transaction(objectStoreName, "readonly"); | ||
var objStore = txn.objectStore(objectStoreName); | ||
var index = objStore.index(indexName); | ||
var rqCursor = index.openCursor(); | ||
rqCursor.onsuccess = t.step_func( function(event) { | ||
var cursor = event.target.result; | ||
if(cursor) { | ||
switch(count) { | ||
case 0: | ||
count += 3; | ||
cursor.advance(3); | ||
break; | ||
case 3: | ||
var record = cursor.value; | ||
assert_equals(record.pKey, records[count].pKey, "record.pKey"); | ||
assert_equals(record.iKey, records[count].iKey, "record.iKey"); | ||
t.done(); | ||
break; | ||
default: | ||
assert_unreached("unexpected count"); | ||
break; | ||
} | ||
} | ||
}); | ||
} | ||
|
||
add_completion_callback(function() { if(db) db.close(); }); | ||
|
||
setup(function() { | ||
var rqDelete = window.indexedDB.deleteDatabase(databaseName); | ||
rqDelete.onsuccess = t.step_func( RunTest ); | ||
}; | ||
|
||
open_rq.onsuccess = function (e) { | ||
var cursor_rq = db.transaction("test") | ||
.objectStore("test") | ||
.index("idx") | ||
.openCursor(); | ||
|
||
cursor_rq.onsuccess = t.step_func(function(e) { | ||
var cursor = e.target.result; | ||
assert_true(cursor instanceof IDBCursor); | ||
|
||
switch(count) { | ||
case 0: | ||
count += 3; | ||
cursor.advance(3); | ||
break; | ||
case 3: | ||
var record = cursor.value; | ||
assert_equals(record.pKey, records[count].pKey, "record.pKey"); | ||
assert_equals(record.iKey, records[count].iKey, "record.iKey"); | ||
t.done(); | ||
break; | ||
default: | ||
assert_unreached("unexpected count"); | ||
break; | ||
} | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
</body> | ||
</html> | ||
} | ||
</script> | ||
|
||
<div id=log></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,53 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title> IDBCursor.advance() - object store - iterate cursor number of times specified by count </title> | ||
<script type="text/javascript" src="support.js"></script> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="text/javascript"> | ||
var objectStoreName = "objectstore"; | ||
var records = [ { pKey: "primaryKey_0" }, | ||
{ pKey: "primaryKey_1" }, | ||
{ pKey: "primaryKey_2" }, | ||
{ pKey: "primaryKey_3" }]; | ||
var count = 0; | ||
var db = null; | ||
var t = async_test(); | ||
|
||
function RunTest() { | ||
var rqOpen = window.indexedDB.open(databaseName, databaseVersion); | ||
rqOpen.onupgradeneeded = t.step_func( function(event) { | ||
db = event.target.result; | ||
db.onerror = t.step_func( assert_database_error ); | ||
var objStore = db.createObjectStore(objectStoreName, {keyPath:"pKey"}); | ||
for(var i = 0; i < records.length; i++) { | ||
objStore.add(records[i]); | ||
} | ||
}); | ||
rqOpen.onsuccess = t.step_func( VerifyCursorIterates ); | ||
rqOpen.onerror = t.step_func( assert_open_request_error ); | ||
<title> IDBCursor.advance() - object store - iterate cursor number of times specified by count </title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src=support.js></script> | ||
|
||
<script> | ||
var db, | ||
count = 0, | ||
t = async_test(), | ||
records = [ { pKey: "primaryKey_0" }, | ||
{ pKey: "primaryKey_1" }, | ||
{ pKey: "primaryKey_2" }, | ||
{ pKey: "primaryKey_3" }]; | ||
|
||
var open_rq = createdb(t); | ||
open_rq.onupgradeneeded = function(e) { | ||
db = event.target.result; | ||
var store = db.createObjectStore("test", {keyPath:"pKey"}); | ||
|
||
for(var i = 0; i < records.length; i++) { | ||
store.add(records[i]); | ||
} | ||
|
||
function VerifyCursorIterates() { | ||
var txn = db.transaction(objectStoreName, "readonly"); | ||
var objStore = txn.objectStore(objectStoreName); | ||
var rqCursor = objStore.openCursor(); | ||
rqCursor.onsuccess = t.step_func( function(event) { | ||
var cursor = event.target.result; | ||
if(cursor) { | ||
switch(count) { | ||
case 0: | ||
count += 3; | ||
cursor.advance(3); | ||
break; | ||
case 3: | ||
var record = cursor.value; | ||
assert_equals(record.pKey, records[count].pKey, "record.pKey"); | ||
t.done(); | ||
break; | ||
default: | ||
assert_unreached("unexpected count"); | ||
break; | ||
} | ||
} | ||
}); | ||
} | ||
|
||
add_completion_callback(function() { if(db) db.close(); }); | ||
|
||
setup(function() { | ||
var rqDelete = window.indexedDB.deleteDatabase(databaseName); | ||
rqDelete.onsuccess = t.step_func( RunTest ); | ||
}; | ||
|
||
open_rq.onsuccess = function (e) { | ||
var cursor_rq = db.transaction("test") | ||
.objectStore("test") | ||
.openCursor(); | ||
|
||
cursor_rq.onsuccess = t.step_func(function(e) { | ||
var cursor = e.target.result; | ||
assert_true(cursor instanceof IDBCursor); | ||
|
||
switch(count) { | ||
case 0: | ||
count += 3; | ||
cursor.advance(3); | ||
break; | ||
case 3: | ||
assert_equals(cursor.value.pKey, records[count].pKey, "cursor.value.pKey"); | ||
t.done(); | ||
break; | ||
default: | ||
assert_unreached("unexpected count"); | ||
break; | ||
} | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
</body> | ||
</html> | ||
} | ||
|
||
</script> | ||
|
||
<div id=log> </div> |
Oops, something went wrong.