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..5ad082d294427b771f7ae99ca3b93d6bc8546f07 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(&IndexedDBContext::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 blob's (but stores them to the same key), and then |
|
jsbell
2015/03/06 18:28:50
Nit: just blobs, no '
cmumford
2015/03/06 19:11:03
done - yes, I keep doing that!
|
| + // a single file. Expect two blob's. |
| + 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 |