Bug 111233 - IndexedDB: Add IDBBackingStoreTest
Summary: IndexedDB: Add IDBBackingStoreTest
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alec Flett
URL:
Keywords:
Depends on:
Blocks: 110820 111138
  Show dependency treegraph
 
Reported: 2013-03-01 16:24 PST by Alec Flett
Modified: 2013-03-05 15:35 PST (History)
5 users (show)

See Also:


Attachments
Patch (9.33 KB, patch)
2013-03-01 16:26 PST, Alec Flett
no flags Details | Formatted Diff | Diff
Patch (9.85 KB, patch)
2013-03-04 10:42 PST, Alec Flett
no flags Details | Formatted Diff | Diff
Patch (9.93 KB, patch)
2013-03-04 17:05 PST, Alec Flett
no flags Details | Formatted Diff | Diff
Patch (10.21 KB, patch)
2013-03-05 12:31 PST, Alec Flett
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Flett 2013-03-01 16:24:38 PST
IndexedDB: Add IDBBackingStoreTest
Comment 1 Alec Flett 2013-03-01 16:26:08 PST
Created attachment 191064 [details]
Patch
Comment 2 Alec Flett 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.
Comment 3 Joshua Bell 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?
Comment 4 Alec Flett 2013-03-04 10:42:13 PST
Created attachment 191270 [details]
Patch
Comment 5 Alec Flett 2013-03-04 11:49:57 PST
jsbell - ready for another review, all comments addressed.
Comment 6 Joshua Bell 2013-03-04 12:08:43 PST
Comment on attachment 191270 [details]
Patch

lgtm
Comment 7 Adam Barth 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?
Comment 8 Alec Flett 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.
Comment 9 Adam Barth 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.
Comment 10 Alec Flett 2013-03-04 17:05:41 PST
Created attachment 191358 [details]
Patch

(thanks..) update to detect webkit unit tests
Comment 11 WebKit Review Bot 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
Comment 12 Alec Flett 2013-03-05 12:31:38 PST
Created attachment 191535 [details]
Patch
Comment 13 Alec Flett 2013-03-05 12:32:32 PST
abarth@ - r? 

(I had to use WebKit::Platform::current() instead of WebKit::Platform())
Comment 14 Adam Barth 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!  :)
Comment 15 Alec Flett 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)
Comment 16 WebKit Review Bot 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>
Comment 17 WebKit Review Bot 2013-03-05 15:35:43 PST
All reviewed patches have been landed.  Closing bug.