Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2011-05-24 Greg Simon <gregsimon@chromium.org>
Reviewed by Dimitri Glazkov. Control Indexeddb backends from LayoutTestController https://bugs.webkit.org/show_bug.cgi?id=61000 LayoutTest for migration between SQLite and LevelDB in IndxededDB. * storage/indexeddb/migrate-basics-expected.txt: Added. * storage/indexeddb/migrate-basics.html: Added. 2011-05-24 Greg Simon <gregsimon@chromium.org> Reviewed by Dimitri Glazkov. Control Indexeddb backends from LayoutTestController https://bugs.webkit.org/show_bug.cgi?id=61000 Test: storage/indexeddb/migrate-basics.html * storage/IDBBackingStore.h: * storage/IDBFactoryBackendImpl.cpp: (WebCore::IDBFactoryBackendImpl::IDBFactoryBackendImpl): (WebCore::IDBFactoryBackendImpl::open): (WebCore::IDBFactoryBackendImpl::setEnableMigration): (WebCore::IDBFactoryBackendImpl::migrate): * storage/IDBFactoryBackendImpl.h: * storage/IDBFactoryBackendInterface.h: * storage/IDBLevelDBBackingStore.cpp: (WebCore::IDBLevelDBBackingStore::backingStoreExists): * storage/IDBLevelDBBackingStore.h: (WebCore::IDBLevelDBBackingStore::backingStoreType): * storage/IDBSQLiteBackingStore.cpp: (WebCore::IDBSQLiteBackingStore::backingStoreExists): * storage/IDBSQLiteBackingStore.h: (WebCore::IDBSQLiteBackingStore::backingStoreType): 2011-05-24 Greg Simon <gregsimon@chromium.org> Reviewed by Dimitri Glazkov. Control Indexeddb backends from LayoutTestController https://bugs.webkit.org/show_bug.cgi?id=61000 * public/WebIDBFactory.h: (WebKit::WebIDBFactory::setEnableMigration): * src/AssertMatchingEnums.cpp: * src/IDBFactoryBackendProxy.cpp: (WebKit::IDBFactoryBackendProxy::setEnableMigration): * src/IDBFactoryBackendProxy.h: * src/WebIDBFactoryImpl.cpp: (WebKit::WebIDBFactory::setOverrideBackingStoreType): (WebKit::WebIDBFactory::setTemporaryDatabaseFolder): (WebKit::WebIDBFactoryImpl::WebIDBFactoryImpl): (WebKit::WebIDBFactoryImpl::open): (WebKit::WebIDBFactoryImpl::setEnableMigration): * src/WebIDBFactoryImpl.h: 2011-05-24 Greg Simon <gregsimon@chromium.org> Reviewed by Dimitri Glazkov. Control Indexeddb backends from LayoutTestController https://bugs.webkit.org/show_bug.cgi?id=61000 * DumpRenderTree/chromium/LayoutTestController.cpp: (LayoutTestController::LayoutTestController): (LayoutTestController::setOverrideIndexedDBBackingStore): (LayoutTestController::clearAllDatabases): * DumpRenderTree/chromium/LayoutTestController.h: Canonical link: https://commits.webkit.org/76809@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@87257 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
472 additions
and 9 deletions.
- +13 −0 LayoutTests/ChangeLog
- +36 −0 LayoutTests/storage/indexeddb/migrate-basics-expected.txt
- +197 −0 LayoutTests/storage/indexeddb/migrate-basics.html
- +26 −0 Source/WebCore/ChangeLog
- +3 −1 Source/WebCore/storage/IDBBackingStore.h
- +37 −4 Source/WebCore/storage/IDBFactoryBackendImpl.cpp
- +4 −0 Source/WebCore/storage/IDBFactoryBackendImpl.h
- +3 −1 Source/WebCore/storage/IDBFactoryBackendInterface.h
- +17 −0 Source/WebCore/storage/IDBLevelDBBackingStore.cpp
- +3 −0 Source/WebCore/storage/IDBLevelDBBackingStore.h
- +12 −0 Source/WebCore/storage/IDBSQLiteBackingStore.cpp
- +3 −0 Source/WebCore/storage/IDBSQLiteBackingStore.h
- +21 −0 Source/WebKit/chromium/ChangeLog
- +7 −1 Source/WebKit/chromium/public/WebIDBFactory.h
- +1 −0 Source/WebKit/chromium/src/AssertMatchingEnums.cpp
- +6 −0 Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp
- +1 −0 Source/WebKit/chromium/src/IDBFactoryBackendProxy.h
- +32 −1 Source/WebKit/chromium/src/WebIDBFactoryImpl.cpp
- +1 −0 Source/WebKit/chromium/src/WebIDBFactoryImpl.h
- +13 −0 Tools/ChangeLog
- +27 −1 Tools/DumpRenderTree/chromium/LayoutTestController.cpp
- +9 −0 Tools/DumpRenderTree/chromium/LayoutTestController.h
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
@@ -0,0 +1,36 @@ | ||
Test migration from SQLite to LevelDB. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
webkitIndexedDB.open('MigrationDatabase') | ||
sqliteCreateSuccess(): | ||
db = event.target.result | ||
db.setVersion('new version') | ||
sqliteSetVersionSuccess(): | ||
window.db.createObjectStore('PlainOldStore', {autoIncrement: false}) | ||
store = window.db.createObjectStore('StoreWithKeyPath', {keyPath: 'id', autoIncrement: true}) | ||
window.db.createObjectStore('StoreWithAutoIncrement', {autoIncrement: true}) | ||
trans = db.transaction([], webkitIDBTransaction.READ_WRITE) | ||
index = store.createIndex('ExampleIndex','id', false) | ||
sqliteTestAddRecords1(): | ||
store = trans.objectStore('PlainOldStore') | ||
store = store.add({name: 'George'},1) | ||
sqliteTestAddRecords2(): | ||
store = trans.objectStore('StoreWithKeyPath') | ||
store.add({name: 'Thomas', id: 3}) | ||
sqliteTestAddRecords3(): | ||
store = trans.objectStore('StoreWithAutoIncrement') | ||
store.add({name: 'Lincoln', number: '7012'}, 5) | ||
leveldbOpenSuccess(): | ||
db = event.target.result | ||
trans = db.transaction([], webkitIDBTransaction.READ_WRITE, 0) | ||
leveldbCheckPlainOldStore(): | ||
store = trans.objectStore('PlainOldStore') | ||
FAIL store = trans.objectStore('PlainOldStore') threw exception Error: NOT_FOUND_ERR: DOM IDBDatabase Exception 3 | ||
request = store.openCursor(keyRange) | ||
FAIL request = store.openCursor(keyRange) threw exception TypeError: Cannot call method 'openCursor' of undefined | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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
@@ -0,0 +1,197 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> | ||
<script src="../../fast/js/resources/js-test-pre.js"></script> | ||
<script src="../../fast/js/resources/js-test-post-function.js"></script> | ||
<script src="resources/shared.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script> | ||
|
||
description("Test migration from SQLite to LevelDB."); | ||
|
||
if (window.layoutTestController) | ||
layoutTestController.waitUntilDone(); | ||
|
||
function test() | ||
{ | ||
if (window.layoutTestController) | ||
layoutTestController.setOverrideIndexedDBBackingStore("sqlite"); | ||
|
||
request = evalAndLog("webkitIndexedDB.open('MigrationDatabase')"); | ||
request.onsuccess = sqliteOpenSuccess; | ||
request.onerror = unexpectedErrorCallback; | ||
} | ||
|
||
function sqliteOpenSuccess() | ||
{ | ||
debug("sqliteCreateSuccess():"); | ||
window.db = evalAndLog("db = event.target.result"); | ||
|
||
request = evalAndLog("db.setVersion('new version')"); | ||
request.onsuccess = sqliteSetVersionSuccess; | ||
request.onerror = unexpectedErrorCallback; | ||
} | ||
|
||
function sqliteSetVersionSuccess() | ||
{ | ||
debug("sqliteSetVersionSuccess():"); | ||
evalAndLog("window.db.createObjectStore('PlainOldStore', {autoIncrement: false})"); | ||
window.store = evalAndLog("store = window.db.createObjectStore('StoreWithKeyPath', {keyPath: 'id', autoIncrement: true})"); | ||
evalAndLog("window.db.createObjectStore('StoreWithAutoIncrement', {autoIncrement: true})"); | ||
|
||
window.trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)"); | ||
window.index = evalAndLog("index = store.createIndex('ExampleIndex','id', false)"); | ||
|
||
|
||
sqliteTestAddRecords1(); | ||
} | ||
|
||
function sqliteTestAddRecords1() | ||
{ | ||
debug("sqliteTestAddRecords1():"); | ||
window.store = evalAndLog("store = trans.objectStore('PlainOldStore')"); | ||
request = evalAndLog("store = store.add({name: 'George'},1)"); | ||
request.onsuccess = sqliteTestAddRecords2; | ||
request.onfailure = unexpectedErrorCallback; | ||
} | ||
|
||
function sqliteTestAddRecords2() | ||
{ | ||
debug("sqliteTestAddRecords2():"); | ||
window.store = evalAndLog("store = trans.objectStore('StoreWithKeyPath')"); | ||
|
||
request = evalAndLog("store.add({name: 'Thomas', id: 3})"); | ||
request.onsuccess = sqliteTestAddRecords3; | ||
request.onfailure = unexpectedErrorCallback; | ||
} | ||
|
||
function sqliteTestAddRecords3() | ||
{ | ||
debug("sqliteTestAddRecords3():"); | ||
window.store = evalAndLog("store = trans.objectStore('StoreWithAutoIncrement')"); | ||
request = evalAndLog("store.add({name: 'Lincoln', number: '7012'}, 5)"); | ||
request.onsuccess = sqliteCloseDatabase; | ||
request.onfailure = unexpectedErrorCallback; | ||
} | ||
|
||
|
||
function sqliteCloseDatabase() | ||
{ | ||
window.db.close(); | ||
window.db = null; | ||
window.trans = null; | ||
leveldbOpen(); | ||
} | ||
|
||
function leveldbOpen() | ||
{ | ||
if (window.layoutTestController) | ||
layoutTestController.setOverrideIndexedDBBackingStore("leveldb"); | ||
|
||
// This next line will trigger the migration. | ||
request = webkitIndexedDB.open('MigrationDatabase'); | ||
request.onsuccess = leveldbOpenSuccess; | ||
request.onerror = unexpectedErrorCallback; | ||
} | ||
|
||
function leveldbOpenSuccess() | ||
{ | ||
debug("leveldbOpenSuccess():"); | ||
window.db = evalAndLog("db = event.target.result"); | ||
window.trans = evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE, 0)"); | ||
leveldbCheckPlainOldStore(); | ||
} | ||
|
||
function leveldbCheckPlainOldStore() | ||
{ | ||
debug("leveldbCheckPlainOldStore():"); | ||
window.store = evalAndLog("store = trans.objectStore('PlainOldStore')"); | ||
window.keyRange = webkitIDBKeyRange.lowerBound(0); | ||
request = evalAndLog("request = store.openCursor(keyRange)"); | ||
if (!request) { | ||
testMigrationEnd(); | ||
return; | ||
} | ||
request.onsuccess = leveldbCheckPlainOldStoreCursorNext; | ||
request.onerror = unexpectedErrorCallback; | ||
} | ||
|
||
function leveldbCheckPlainOldStoreCursorNext() | ||
{ | ||
debug("leveldbCheckPlainOldStoreCursorNext():"); | ||
window.cursor = event.target.result; | ||
if (!window.cursor) { | ||
leveldbCheckStoreWithKeyPath(); | ||
return; | ||
} | ||
|
||
shouldBeTrue("cursor.value.name == 'George'"); | ||
cursor.continue(); | ||
} | ||
|
||
function leveldbCheckStoreWithKeyPath() | ||
{ | ||
debug("leveldbCheckStoreWithKeyPath():"); | ||
window.store = evalAndLog("store = trans.objectStore('StoreWithKeyPath')"); | ||
var keyRange = webkitIDBKeyRange.lowerBound(0); | ||
request = store.openCursor(keyRange); | ||
request.onsuccess = leveldbCheckStoreWithKeyPathCursorNext; | ||
request.onerror = unexpectedErrorCallback; | ||
} | ||
|
||
function leveldbCheckStoreWithKeyPathCursorNext() | ||
{ | ||
debug("leveldbCheckStoreWithKeyPathCursorNext():"); | ||
window.cursor = event.target.result; | ||
if (!window.cursor) { | ||
leveldbCheckStoreWithAutoIncrement(); | ||
return; | ||
} | ||
|
||
shouldBeTrue("cursor.value.name == 'Thomas'"); | ||
shouldBeTrue("cursor.value.id == '3'"); | ||
cursor.continue(); | ||
} | ||
|
||
function leveldbCheckStoreWithAutoIncrement() | ||
{ | ||
debug("leveldbCheckStoreWithAutoIncrement():"); | ||
window.store = evalAndLog("store = trans.objectStore('StoreWithAutoIncrement')"); | ||
var keyRange = webkitIDBKeyRange.lowerBound(0); | ||
request = store.openCursor(keyRange); | ||
request.onsuccess = leveldbCheckStoreWithAutoIncrementCursorNext; | ||
request.onerror = unexpectedErrorCallback; | ||
} | ||
function leveldbCheckStoreWithAutoIncrementCursorNext() | ||
{ | ||
debug("leveldbCheckStoreWithAutoIncrementCursorNext():"); | ||
window.cursor = event.target.result; | ||
if (!window.cursor) { | ||
testMigrationEnd(); | ||
return; | ||
} | ||
|
||
shouldBeTrue("cursor.value.name == 'Lincoln'"); | ||
shouldBeTrue("cursor.value.number == '7012'"); | ||
cursor.continue(); | ||
} | ||
|
||
function testMigrationEnd() | ||
{ | ||
window.db.close(); | ||
window.db = null; | ||
layoutTestController.clearAllDatabases(); | ||
layoutTestController.setOverrideIndexedDBBackingStore("default"); | ||
done(); | ||
} | ||
|
||
test(); | ||
|
||
var successfullyParsed = true; | ||
|
||
</script> | ||
</body> | ||
</html> |
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
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
Oops, something went wrong.