Commit 62b7f237 authored by jsbell@chromium.org's avatar jsbell@chromium.org

deleteDatabase() success should be IDBVersionChangeEvent [Tests]

New tests only. Originally reviewed as part of crrev.com/235493003
but split out for a 3-part landing (blink, chromium, tests).

TBR=dgrogan@chromium.org,cmumford@chromium.org
BUG=362251

Review URL: https://codereview.chromium.org/235933010

git-svn-id: svn://svn.chromium.org/blink/trunk@171507 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f457cf56
This is a testharness.js-based test.
PASS deleteDatabase success event type, existing DB
PASS deleteDatabase success event, non-existent DB
Harness: the test ran to completion.
<!DOCTYPE html>
<title>IndexedDB: Verify deleteDatabase success event</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
(function() {
var t = async_test('deleteDatabase success event type, existing DB');
t.step(function() {
var dbName = 'db' + location.pathname;
var openRequest = indexedDB.open(dbName, 9);
openRequest.onsuccess = t.step_func(function(e) {
var db = openRequest.result;
db.close();
var deleteRequest = indexedDB.deleteDatabase(dbName);
deleteRequest.onsuccess = t.step_func(function(e) {
assert_equals(deleteRequest.result, undefined,
'...the implementation must set the result of the request to undefined...');
assert_true(e instanceof IDBVersionChangeEvent,
'The event must implement the IDBVersionChangeEvent interface ...');
assert_equals(e.oldVersion, 9,
'and have oldVersion set to database version...');
assert_equals(e.newVersion, null,
'and have the newVersion property set to null.');
t.done();
});
});
});
}());
(function() {
var t = async_test('deleteDatabase success event, non-existent DB');
t.step(function() {
var dbName = 'db' + location.pathname + '-does-not-exist';
var deleteRequest = indexedDB.deleteDatabase(dbName);
deleteRequest.onsuccess = t.step_func(function(e) {
assert_equals(deleteRequest.result, undefined,
'...the implementation must set the result of the request to undefined...');
assert_true(e instanceof IDBVersionChangeEvent,
'The event must implement the IDBVersionChangeEvent interface ...');
assert_equals(e.oldVersion, 0,
'and have oldVersion set to database version...');
assert_equals(e.newVersion, null,
'and have the newVersion property set to null.');
t.done();
});
});
}());
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment