| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include "base/bind.h" | 8 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 7 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 8 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 11 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 12 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 14 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/test/thread_test_helper.h" | 20 #include "base/test/thread_test_helper.h" |
| 21 #include "build/build_config.h" |
| 17 #include "content/browser/browser_main_loop.h" | 22 #include "content/browser/browser_main_loop.h" |
| 18 #include "content/browser/indexed_db/indexed_db_class_factory.h" | 23 #include "content/browser/indexed_db/indexed_db_class_factory.h" |
| 19 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 24 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 20 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" | 25 #include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h
" |
| 21 #include "content/browser/web_contents/web_contents_impl.h" | 26 #include "content/browser/web_contents/web_contents_impl.h" |
| 22 #include "content/public/browser/browser_context.h" | 27 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
| 25 #include "content/public/browser/storage_partition.h" | 30 #include "content/public/browser/storage_partition.h" |
| 26 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 118 } |
| 114 | 119 |
| 115 void SetQuota(int quota_kilobytes) { | 120 void SetQuota(int quota_kilobytes) { |
| 116 const int kTemporaryStorageQuotaSize = | 121 const int kTemporaryStorageQuotaSize = |
| 117 quota_kilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion; | 122 quota_kilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion; |
| 118 SetTempQuota(kTemporaryStorageQuotaSize, | 123 SetTempQuota(kTemporaryStorageQuotaSize, |
| 119 BrowserContext::GetDefaultStoragePartition( | 124 BrowserContext::GetDefaultStoragePartition( |
| 120 shell()->web_contents()->GetBrowserContext())->GetQuotaManager()); | 125 shell()->web_contents()->GetBrowserContext())->GetQuotaManager()); |
| 121 } | 126 } |
| 122 | 127 |
| 123 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { | 128 static void SetTempQuota(int64_t bytes, scoped_refptr<QuotaManager> qm) { |
| 124 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 129 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 125 BrowserThread::PostTask( | 130 BrowserThread::PostTask( |
| 126 BrowserThread::IO, FROM_HERE, | 131 BrowserThread::IO, FROM_HERE, |
| 127 base::Bind(&IndexedDBBrowserTest::SetTempQuota, bytes, qm)); | 132 base::Bind(&IndexedDBBrowserTest::SetTempQuota, bytes, qm)); |
| 128 return; | 133 return; |
| 129 } | 134 } |
| 130 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 135 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 131 qm->SetTemporaryGlobalOverrideQuota(bytes, storage::QuotaCallback()); | 136 qm->SetTemporaryGlobalOverrideQuota(bytes, storage::QuotaCallback()); |
| 132 // Don't return until the quota has been set. | 137 // Don't return until the quota has been set. |
| 133 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 138 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
| 134 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 139 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
| 135 ASSERT_TRUE(helper->Run()); | 140 ASSERT_TRUE(helper->Run()); |
| 136 } | 141 } |
| 137 | 142 |
| 138 virtual int64 RequestDiskUsage() { | 143 virtual int64_t RequestDiskUsage() { |
| 139 PostTaskAndReplyWithResult( | 144 PostTaskAndReplyWithResult( |
| 140 GetContext()->TaskRunner(), | 145 GetContext()->TaskRunner(), |
| 141 FROM_HERE, | 146 FROM_HERE, |
| 142 base::Bind(&IndexedDBContext::GetOriginDiskUsage, | 147 base::Bind(&IndexedDBContext::GetOriginDiskUsage, |
| 143 GetContext(), | 148 GetContext(), |
| 144 GURL("file:///")), | 149 GURL("file:///")), |
| 145 base::Bind(&IndexedDBBrowserTest::DidGetDiskUsage, this)); | 150 base::Bind(&IndexedDBBrowserTest::DidGetDiskUsage, this)); |
| 146 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 151 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
| 147 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); | 152 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); |
| 148 EXPECT_TRUE(helper->Run()); | 153 EXPECT_TRUE(helper->Run()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 169 static MockBrowserTestIndexedDBClassFactory* GetTestClassFactory() { | 174 static MockBrowserTestIndexedDBClassFactory* GetTestClassFactory() { |
| 170 static ::base::LazyInstance<MockBrowserTestIndexedDBClassFactory>::Leaky | 175 static ::base::LazyInstance<MockBrowserTestIndexedDBClassFactory>::Leaky |
| 171 s_factory = LAZY_INSTANCE_INITIALIZER; | 176 s_factory = LAZY_INSTANCE_INITIALIZER; |
| 172 return s_factory.Pointer(); | 177 return s_factory.Pointer(); |
| 173 } | 178 } |
| 174 | 179 |
| 175 static IndexedDBClassFactory* GetIDBClassFactory() { | 180 static IndexedDBClassFactory* GetIDBClassFactory() { |
| 176 return GetTestClassFactory(); | 181 return GetTestClassFactory(); |
| 177 } | 182 } |
| 178 | 183 |
| 179 virtual void DidGetDiskUsage(int64 bytes) { | 184 virtual void DidGetDiskUsage(int64_t bytes) { disk_usage_ = bytes; } |
| 180 disk_usage_ = bytes; | |
| 181 } | |
| 182 | 185 |
| 183 virtual void DidGetBlobFileCount(int count) { blob_file_count_ = count; } | 186 virtual void DidGetBlobFileCount(int count) { blob_file_count_ = count; } |
| 184 | 187 |
| 185 int64 disk_usage_; | 188 int64_t disk_usage_; |
| 186 int blob_file_count_ = 0; | 189 int blob_file_count_ = 0; |
| 187 | 190 |
| 188 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTest); | 191 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTest); |
| 189 }; | 192 }; |
| 190 | 193 |
| 191 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { | 194 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { |
| 192 SimpleTest(GetTestUrl("indexeddb", "cursor_test.html")); | 195 SimpleTest(GetTestUrl("indexeddb", "cursor_test.html")); |
| 193 } | 196 } |
| 194 | 197 |
| 195 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTestIncognito) { | 198 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTestIncognito) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 SimpleTest(GetTestUrl("indexeddb", "migration_test.html")); | 348 SimpleTest(GetTestUrl("indexeddb", "migration_test.html")); |
| 346 } | 349 } |
| 347 | 350 |
| 348 class IndexedDBBrowserTestWithVersion123456Schema : public | 351 class IndexedDBBrowserTestWithVersion123456Schema : public |
| 349 IndexedDBBrowserTestWithPreexistingLevelDB { | 352 IndexedDBBrowserTestWithPreexistingLevelDB { |
| 350 std::string EnclosingLevelDBDir() override { return "schema_version_123456"; } | 353 std::string EnclosingLevelDBDir() override { return "schema_version_123456"; } |
| 351 }; | 354 }; |
| 352 | 355 |
| 353 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema, | 356 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema, |
| 354 DestroyTest) { | 357 DestroyTest) { |
| 355 int64 original_size = RequestDiskUsage(); | 358 int64_t original_size = RequestDiskUsage(); |
| 356 EXPECT_GT(original_size, 0); | 359 EXPECT_GT(original_size, 0); |
| 357 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); | 360 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); |
| 358 int64 new_size = RequestDiskUsage(); | 361 int64_t new_size = RequestDiskUsage(); |
| 359 EXPECT_GT(new_size, 0); | 362 EXPECT_GT(new_size, 0); |
| 360 EXPECT_NE(original_size, new_size); | 363 EXPECT_NE(original_size, new_size); |
| 361 } | 364 } |
| 362 | 365 |
| 363 class IndexedDBBrowserTestWithVersion987654SSVData : public | 366 class IndexedDBBrowserTestWithVersion987654SSVData : public |
| 364 IndexedDBBrowserTestWithPreexistingLevelDB { | 367 IndexedDBBrowserTestWithPreexistingLevelDB { |
| 365 std::string EnclosingLevelDBDir() override { return "ssv_version_987654"; } | 368 std::string EnclosingLevelDBDir() override { return "ssv_version_987654"; } |
| 366 }; | 369 }; |
| 367 | 370 |
| 368 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData, | 371 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData, |
| 369 DestroyTest) { | 372 DestroyTest) { |
| 370 int64 original_size = RequestDiskUsage(); | 373 int64_t original_size = RequestDiskUsage(); |
| 371 EXPECT_GT(original_size, 0); | 374 EXPECT_GT(original_size, 0); |
| 372 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); | 375 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); |
| 373 int64 new_size = RequestDiskUsage(); | 376 int64_t new_size = RequestDiskUsage(); |
| 374 EXPECT_GT(new_size, 0); | 377 EXPECT_GT(new_size, 0); |
| 375 EXPECT_NE(original_size, new_size); | 378 EXPECT_NE(original_size, new_size); |
| 376 } | 379 } |
| 377 | 380 |
| 378 class IndexedDBBrowserTestWithCorruptLevelDB : public | 381 class IndexedDBBrowserTestWithCorruptLevelDB : public |
| 379 IndexedDBBrowserTestWithPreexistingLevelDB { | 382 IndexedDBBrowserTestWithPreexistingLevelDB { |
| 380 std::string EnclosingLevelDBDir() override { return "corrupt_leveldb"; } | 383 std::string EnclosingLevelDBDir() override { return "corrupt_leveldb"; } |
| 381 }; | 384 }; |
| 382 | 385 |
| 383 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB, | 386 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB, |
| 384 DestroyTest) { | 387 DestroyTest) { |
| 385 int64 original_size = RequestDiskUsage(); | 388 int64_t original_size = RequestDiskUsage(); |
| 386 EXPECT_GT(original_size, 0); | 389 EXPECT_GT(original_size, 0); |
| 387 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); | 390 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); |
| 388 int64 new_size = RequestDiskUsage(); | 391 int64_t new_size = RequestDiskUsage(); |
| 389 EXPECT_GT(new_size, 0); | 392 EXPECT_GT(new_size, 0); |
| 390 EXPECT_NE(original_size, new_size); | 393 EXPECT_NE(original_size, new_size); |
| 391 } | 394 } |
| 392 | 395 |
| 393 class IndexedDBBrowserTestWithMissingSSTFile : public | 396 class IndexedDBBrowserTestWithMissingSSTFile : public |
| 394 IndexedDBBrowserTestWithPreexistingLevelDB { | 397 IndexedDBBrowserTestWithPreexistingLevelDB { |
| 395 std::string EnclosingLevelDBDir() override { return "missing_sst"; } | 398 std::string EnclosingLevelDBDir() override { return "missing_sst"; } |
| 396 }; | 399 }; |
| 397 | 400 |
| 398 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithMissingSSTFile, | 401 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithMissingSSTFile, |
| 399 DestroyTest) { | 402 DestroyTest) { |
| 400 int64 original_size = RequestDiskUsage(); | 403 int64_t original_size = RequestDiskUsage(); |
| 401 EXPECT_GT(original_size, 0); | 404 EXPECT_GT(original_size, 0); |
| 402 SimpleTest(GetTestUrl("indexeddb", "open_missing_table.html")); | 405 SimpleTest(GetTestUrl("indexeddb", "open_missing_table.html")); |
| 403 int64 new_size = RequestDiskUsage(); | 406 int64_t new_size = RequestDiskUsage(); |
| 404 EXPECT_GT(new_size, 0); | 407 EXPECT_GT(new_size, 0); |
| 405 EXPECT_NE(original_size, new_size); | 408 EXPECT_NE(original_size, new_size); |
| 406 } | 409 } |
| 407 | 410 |
| 408 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, LevelDBLogFileTest) { | 411 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, LevelDBLogFileTest) { |
| 409 // Any page that opens an IndexedDB will work here. | 412 // Any page that opens an IndexedDB will work here. |
| 410 SimpleTest(GetTestUrl("indexeddb", "database_test.html")); | 413 SimpleTest(GetTestUrl("indexeddb", "database_test.html")); |
| 411 base::FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); | 414 base::FilePath leveldb_dir(FILE_PATH_LITERAL("file__0.indexeddb.leveldb")); |
| 412 base::FilePath log_file(FILE_PATH_LITERAL("LOG")); | 415 base::FilePath log_file(FILE_PATH_LITERAL("LOG")); |
| 413 base::FilePath log_file_path = | 416 base::FilePath log_file_path = |
| 414 GetContext()->data_path().Append(leveldb_dir).Append(log_file); | 417 GetContext()->data_path().Append(leveldb_dir).Append(log_file); |
| 415 int64 size; | 418 int64_t size; |
| 416 EXPECT_TRUE(base::GetFileSize(log_file_path, &size)); | 419 EXPECT_TRUE(base::GetFileSize(log_file_path, &size)); |
| 417 EXPECT_GT(size, 0); | 420 EXPECT_GT(size, 0); |
| 418 } | 421 } |
| 419 | 422 |
| 420 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CanDeleteWhenOverQuotaTest) { | 423 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CanDeleteWhenOverQuotaTest) { |
| 421 SimpleTest(GetTestUrl("indexeddb", "fill_up_5k.html")); | 424 SimpleTest(GetTestUrl("indexeddb", "fill_up_5k.html")); |
| 422 int64 size = RequestDiskUsage(); | 425 int64_t size = RequestDiskUsage(); |
| 423 const int kQuotaKilobytes = 2; | 426 const int kQuotaKilobytes = 2; |
| 424 EXPECT_GT(size, kQuotaKilobytes * 1024); | 427 EXPECT_GT(size, kQuotaKilobytes * 1024); |
| 425 SetQuota(kQuotaKilobytes); | 428 SetQuota(kQuotaKilobytes); |
| 426 SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html")); | 429 SimpleTest(GetTestUrl("indexeddb", "delete_over_quota.html")); |
| 427 } | 430 } |
| 428 | 431 |
| 429 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, EmptyBlob) { | 432 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, EmptyBlob) { |
| 430 // First delete all IDB's for the test origin | 433 // First delete all IDB's for the test origin |
| 431 GetContext()->TaskRunner()->PostTask( | 434 GetContext()->TaskRunner()->PostTask( |
| 432 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, | 435 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 shell()->web_contents()->GetBrowserContext()); | 477 shell()->web_contents()->GetBrowserContext()); |
| 475 EXPECT_EQ(0UL, blob_context->context()->blob_count()); | 478 EXPECT_EQ(0UL, blob_context->context()->blob_count()); |
| 476 } | 479 } |
| 477 | 480 |
| 478 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, BlobsCountAgainstQuota) { | 481 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, BlobsCountAgainstQuota) { |
| 479 SimpleTest(GetTestUrl("indexeddb", "blobs_use_quota.html")); | 482 SimpleTest(GetTestUrl("indexeddb", "blobs_use_quota.html")); |
| 480 } | 483 } |
| 481 | 484 |
| 482 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteForOriginDeletesBlobs) { | 485 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DeleteForOriginDeletesBlobs) { |
| 483 SimpleTest(GetTestUrl("indexeddb", "write_20mb_blob.html")); | 486 SimpleTest(GetTestUrl("indexeddb", "write_20mb_blob.html")); |
| 484 int64 size = RequestDiskUsage(); | 487 int64_t size = RequestDiskUsage(); |
| 485 // This assertion assumes that we do not compress blobs. | 488 // This assertion assumes that we do not compress blobs. |
| 486 EXPECT_GT(size, 20 << 20 /* 20 MB */); | 489 EXPECT_GT(size, 20 << 20 /* 20 MB */); |
| 487 GetContext()->TaskRunner()->PostTask( | 490 GetContext()->TaskRunner()->PostTask( |
| 488 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, | 491 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, |
| 489 GetContext(), GURL("file:///"))); | 492 GetContext(), GURL("file:///"))); |
| 490 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 493 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
| 491 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); | 494 BrowserMainLoop::GetInstance()->indexed_db_thread()->task_runner())); |
| 492 ASSERT_TRUE(helper->Run()); | 495 ASSERT_TRUE(helper->Run()); |
| 493 EXPECT_EQ(0, RequestDiskUsage()); | 496 EXPECT_EQ(0, RequestDiskUsage()); |
| 494 } | 497 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 547 |
| 545 int num_files = 0; | 548 int num_files = 0; |
| 546 int num_errors = 0; | 549 int num_errors = 0; |
| 547 const bool recursive = false; | 550 const bool recursive = false; |
| 548 for (const base::FilePath& idb_data_path : | 551 for (const base::FilePath& idb_data_path : |
| 549 context->GetStoragePaths(origin_url)) { | 552 context->GetStoragePaths(origin_url)) { |
| 550 base::FileEnumerator enumerator( | 553 base::FileEnumerator enumerator( |
| 551 idb_data_path, recursive, base::FileEnumerator::FILES); | 554 idb_data_path, recursive, base::FileEnumerator::FILES); |
| 552 for (base::FilePath idb_file = enumerator.Next(); !idb_file.empty(); | 555 for (base::FilePath idb_file = enumerator.Next(); !idb_file.empty(); |
| 553 idb_file = enumerator.Next()) { | 556 idb_file = enumerator.Next()) { |
| 554 int64 size(0); | 557 int64_t size(0); |
| 555 GetFileSize(idb_file, &size); | 558 GetFileSize(idb_file, &size); |
| 556 | 559 |
| 557 if (idb_file.Extension() == FILE_PATH_LITERAL(".ldb")) { | 560 if (idb_file.Extension() == FILE_PATH_LITERAL(".ldb")) { |
| 558 num_files++; | 561 num_files++; |
| 559 base::File file( | 562 base::File file( |
| 560 idb_file, base::File::FLAG_WRITE | base::File::FLAG_OPEN_TRUNCATED); | 563 idb_file, base::File::FLAG_WRITE | base::File::FLAG_OPEN_TRUNCATED); |
| 561 if (file.IsValid()) { | 564 if (file.IsValid()) { |
| 562 // Was opened truncated, expand back to the original | 565 // Was opened truncated, expand back to the original |
| 563 // file size and fill with zeros (corrupting the file). | 566 // file size and fill with zeros (corrupting the file). |
| 564 file.SetLength(size); | 567 file.SetLength(size); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 "getAll", | 720 "getAll", |
| 718 "failWebkitGetDatabaseNames", | 721 "failWebkitGetDatabaseNames", |
| 719 "iterate", | 722 "iterate", |
| 720 "failTransactionCommit", | 723 "failTransactionCommit", |
| 721 "clearObjectStore")); | 724 "clearObjectStore")); |
| 722 | 725 |
| 723 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, | 726 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, |
| 724 DeleteCompactsBackingStore) { | 727 DeleteCompactsBackingStore) { |
| 725 const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html"); | 728 const GURL test_url = GetTestUrl("indexeddb", "delete_compact.html"); |
| 726 SimpleTest(GURL(test_url.spec() + "#fill")); | 729 SimpleTest(GURL(test_url.spec() + "#fill")); |
| 727 int64 after_filling = RequestDiskUsage(); | 730 int64_t after_filling = RequestDiskUsage(); |
| 728 EXPECT_GT(after_filling, 0); | 731 EXPECT_GT(after_filling, 0); |
| 729 | 732 |
| 730 SimpleTest(GURL(test_url.spec() + "#purge")); | 733 SimpleTest(GURL(test_url.spec() + "#purge")); |
| 731 int64 after_deleting = RequestDiskUsage(); | 734 int64_t after_deleting = RequestDiskUsage(); |
| 732 EXPECT_LT(after_deleting, after_filling); | 735 EXPECT_LT(after_deleting, after_filling); |
| 733 | 736 |
| 734 // The above tests verify basic assertions - that filling writes data and | 737 // The above tests verify basic assertions - that filling writes data and |
| 735 // deleting reduces the amount stored. | 738 // deleting reduces the amount stored. |
| 736 | 739 |
| 737 // The below tests make assumptions about implementation specifics, such as | 740 // The below tests make assumptions about implementation specifics, such as |
| 738 // data compression, compaction efficiency, and the maximum amount of | 741 // data compression, compaction efficiency, and the maximum amount of |
| 739 // metadata and log data remains after a deletion. It is possible that | 742 // metadata and log data remains after a deletion. It is possible that |
| 740 // changes to the implementation may require these constants to be tweaked. | 743 // changes to the implementation may require these constants to be tweaked. |
| 741 | 744 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 command_line->AppendSwitch(switches::kSingleProcess); | 846 command_line->AppendSwitch(switches::kSingleProcess); |
| 844 } | 847 } |
| 845 }; | 848 }; |
| 846 | 849 |
| 847 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 850 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 848 RenderThreadShutdownTest) { | 851 RenderThreadShutdownTest) { |
| 849 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 852 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 850 } | 853 } |
| 851 | 854 |
| 852 } // namespace content | 855 } // namespace content |
| OLD | NEW |