RESOLVED FIXED Bug 111233
IndexedDB: Add IDBBackingStoreTest
https://bugs.webkit.org/show_bug.cgi?id=111233
Summary IndexedDB: Add IDBBackingStoreTest
Alec Flett
Reported 2013-03-01 16:24:38 PST
IndexedDB: Add IDBBackingStoreTest
Attachments
Patch (9.33 KB, patch)
2013-03-01 16:26 PST, Alec Flett
no flags
Patch (9.85 KB, patch)
2013-03-04 10:42 PST, Alec Flett
no flags
Patch (9.93 KB, patch)
2013-03-04 17:05 PST, Alec Flett
no flags
Patch (10.21 KB, patch)
2013-03-05 12:31 PST, Alec Flett
no flags
Alec Flett
Comment 1 2013-03-01 16:26:08 PST
Alec Flett
Comment 2 2013-03-01 16:27:51 PST
jsbell / dgrogan - mind taking a look? This will let us do all sorts of things, like programmatically corrupt the DB in different ways beyond just LevelDB corruption. Note that the headers are weirdly spaced but this is the only way that the webkit-style checker would allow them to be.
Joshua Bell
Comment 3 2013-03-01 16:48:13 PST
Comment on attachment 191064 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=191064&action=review > Source/WebKit/chromium/ChangeLog:13 > + (WebCore): Delete these generic lines since they don't add value to the ChangeLog. > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:47 > + String pathBase; Add comment that empty pathBase == in-memory database? (I may refactor to be an explicit IDBBackingStore::openInMemory so that decision is made in IDBFactory, but that's uncertain.) > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:59 > +protected: Blank line before/no blank after? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:73 > + Extra blank line? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:101 > + bool ok = m_backingStore->putRecord(&transaction1, 1UL << 35, 1UL << 39, *m_key1.get(), SharedBuffer::create(m_value1.data(), m_value1.size()), &record); Use consts for 1UL<<35, 1UL<<39 ? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:111 > + bool ok = m_backingStore->getRecord(&transaction2, 1UL << 35, 1UL << 39, *m_key1.get(), resultValue); ... since they're repeated here. > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:123 > + int64_t intVersion = 9; const for all of these? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:135 > + bool ok = m_backingStore->createIDBDatabaseMetaData("db1", version, intVersion, databaseId); constant for "db1" ? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:142 > + ok = m_backingStore->createObjectStore(&transaction, databaseId, objectStoreId, "objectStore1", objectStoreKeyPath, autoIncrement); EXPECT_TRUE(ok) after this? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:147 > + Spacing looks weird here. > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:154 > + bool ok = m_backingStore->getIDBDatabaseMetaData("db1", &database, found); EXPECT_TRUE(found) ? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:157 > + // database.name is not filled in by the implementation. Huh... I wonder why we even have it as a property in IDBMetadata? Ah well. > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:166 > + EXPECT_EQ("objectStore1", objectStore.name); EXPECT_EQ's for the other object store properties? > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:173 > + Lots of extra whitespace here?
Alec Flett
Comment 4 2013-03-04 10:42:13 PST
Alec Flett
Comment 5 2013-03-04 11:49:57 PST
jsbell - ready for another review, all comments addressed.
Joshua Bell
Comment 6 2013-03-04 12:08:43 PST
Comment on attachment 191270 [details] Patch lgtm
Adam Barth
Comment 7 2013-03-04 13:22:02 PST
Comment on attachment 191270 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=191270&action=review > Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp:344 > + // Only null in tests. Can we make this comment into an ASSERT?
Alec Flett
Comment 8 2013-03-04 14:22:56 PST
abarth@ - is there an existing way to do test-only asserts beyond plumbing a boolean value in from our tests + non-test code? I couldn't find any examples in existing code.
Adam Barth
Comment 9 2013-03-04 16:57:17 PST
You can check whether WebKit::Platform()->unitTestSupport() is non-null: ASSERT(m_factory || WebKit::Platform()->unitTestSupport()); You might need to wrap that in a PLATFORM(CHROMIUM) ifdef.
Alec Flett
Comment 10 2013-03-04 17:05:41 PST
Created attachment 191358 [details] Patch (thanks..) update to detect webkit unit tests
WebKit Review Bot
Comment 11 2013-03-04 18:35:11 PST
Comment on attachment 191358 [details] Patch Attachment 191358 [details] did not pass cr-linux-debug-ews (chromium-xvfb): Output: http://webkit-commit-queue.appspot.com/results/16930052
Alec Flett
Comment 12 2013-03-05 12:31:38 PST
Alec Flett
Comment 13 2013-03-05 12:32:32 PST
abarth@ - r? (I had to use WebKit::Platform::current() instead of WebKit::Platform())
Adam Barth
Comment 14 2013-03-05 13:35:53 PST
Comment on attachment 191535 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=191535&action=review > Source/WebKit/chromium/tests/IDBBackingStoreTest.cpp:32 > +#include "config.h" > + > +#include "IDBBackingStore.h" > + > +#include "SharedBuffer.h" > + > +#include <gtest/gtest.h> So many blank lines! :)
Alec Flett
Comment 15 2013-03-05 15:06:15 PST
Comment on attachment 191535 [details] Patch (those blank lines are soley to make the webkit-style checker happy)
WebKit Review Bot
Comment 16 2013-03-05 15:35:39 PST
Comment on attachment 191535 [details] Patch Clearing flags on attachment: 191535 Committed r144830: <http://trac.webkit.org/changeset/144830>
WebKit Review Bot
Comment 17 2013-03-05 15:35:43 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.