| Index: content/browser/indexed_db/indexed_db_browsertest.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc
|
| index fbe35bf8499159e328f4c941901382773a70596f..c63475abd040bcc0b081537c868aed81e118f810 100644
|
| --- a/content/browser/indexed_db/indexed_db_browsertest.cc
|
| +++ b/content/browser/indexed_db/indexed_db_browsertest.cc
|
| @@ -150,6 +150,22 @@ class IndexedDBBrowserTest : public ContentBrowserTest {
|
| return disk_usage_;
|
| }
|
|
|
| + virtual int RequestBlobFileCount() {
|
| + PostTaskAndReplyWithResult(
|
| + GetContext()->TaskRunner(), FROM_HERE,
|
| + base::Bind(&IndexedDBContextImpl::GetOriginBlobFileCount, GetContext(),
|
| + GURL("file:///")),
|
| + base::Bind(&IndexedDBBrowserTest::DidGetBlobFileCount, this));
|
| + scoped_refptr<base::ThreadTestHelper> helper(
|
| + new base::ThreadTestHelper(BrowserMainLoop::GetInstance()
|
| + ->indexed_db_thread()
|
| + ->message_loop_proxy()));
|
| + EXPECT_TRUE(helper->Run());
|
| + // Wait for DidGetBlobFileCount to be called.
|
| + base::MessageLoop::current()->RunUntilIdle();
|
| + return blob_file_count_;
|
| + }
|
| +
|
| private:
|
| static MockBrowserTestIndexedDBClassFactory* GetTestClassFactory() {
|
| static ::base::LazyInstance<MockBrowserTestIndexedDBClassFactory>::Leaky
|
| @@ -165,7 +181,10 @@ class IndexedDBBrowserTest : public ContentBrowserTest {
|
| disk_usage_ = bytes;
|
| }
|
|
|
| + virtual void DidGetBlobFileCount(int count) { blob_file_count_ = count; }
|
| +
|
| int64 disk_usage_;
|
| + int blob_file_count_ = 0;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTest);
|
| };
|
| @@ -405,6 +424,17 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CanDeleteWhenOverQuotaTest) {
|
| SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html"));
|
| }
|
|
|
| +IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, EmptyBlob) {
|
| + // First delete all IDB's for the test origin
|
| + GetContext()->TaskRunner()->PostTask(
|
| + FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin,
|
| + GetContext(), GURL("file:///")));
|
| + EXPECT_EQ(0, RequestBlobFileCount()); // Start with no blob files.
|
| + SimpleTest(GetTestUrl("indexeddb", "empty_blob.html"));
|
| + // Test stores one blob and one file to disk, so expect two files.
|
| + EXPECT_EQ(2, RequestBlobFileCount());
|
| +}
|
| +
|
| IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, BlobDidAck) {
|
| SimpleTest(GetTestUrl("indexeddb", "blob_did_ack.html"));
|
| // Wait for idle so that the blob ack has time to be received/processed by
|
|
|