Chromium Code Reviews| 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..f4c61a1425feca2de2d47c20d538d672bb1fb052 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,18 @@ 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 creates two blobs (but stores them to the same key), and then |
|
michaeln
2015/03/09 21:15:18
Honestly this comment is still confusing? The test
cmumford
2015/03/09 22:05:10
My bad - intended to fix that in previous patch.
|
| + // a single file. Expect two blobs. |
| + 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 |