| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, | 434 FROM_HERE, base::Bind(&IndexedDBContextImpl::DeleteForOrigin, |
| 435 GetContext(), GURL("file:///"))); | 435 GetContext(), GURL("file:///"))); |
| 436 scoped_refptr<base::ThreadTestHelper> helper( | 436 scoped_refptr<base::ThreadTestHelper> helper( |
| 437 new base::ThreadTestHelper(BrowserMainLoop::GetInstance() | 437 new base::ThreadTestHelper(BrowserMainLoop::GetInstance() |
| 438 ->indexed_db_thread() | 438 ->indexed_db_thread() |
| 439 ->message_loop_proxy())); | 439 ->message_loop_proxy())); |
| 440 ASSERT_TRUE(helper->Run()); | 440 ASSERT_TRUE(helper->Run()); |
| 441 EXPECT_EQ(0, RequestDiskUsage()); | 441 EXPECT_EQ(0, RequestDiskUsage()); |
| 442 } | 442 } |
| 443 | 443 |
| 444 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DiskFullOnCommit) { |
| 445 // Ignore several preceding transactions: |
| 446 // * The test calls deleteDatabase() which opens the backing store: |
| 447 // #1: IndexedDBBackingStore::OpenBackingStore |
| 448 // => IndexedDBBackingStore::SetUpMetadata |
| 449 // #2: IndexedDBBackingStore::OpenBackingStore |
| 450 // => IndexedDBBackingStore::CleanUpBlobJournal (no-op) |
| 451 // * Then deletes the database: |
| 452 // #3: IndexedDBFactoryImpl::DeleteDatabase |
| 453 // => IndexedDBDatabase::Create |
| 454 // => IndexedDBBackingStore::CreateIDBDatabaseMetaData |
| 455 // #4: IndexedDBFactoryImpl::DeleteDatabase |
| 456 // => IndexedDBDatabase::DeleteDatabase |
| 457 // => IndexedDBBackingStore::DeleteDatabase |
| 458 // => IndexedDBBackingStore::CleanUpBlobJournal (no-op) |
| 459 // * The test calls open(), to create a new database: |
| 460 // #5: IndexedDBFactoryImpl::Open |
| 461 // => IndexedDBDatabase::Create |
| 462 // => IndexedDBBackingStore::CreateIDBDatabaseMetaData |
| 463 // #6: IndexedDBTransaction::Commit - initial "versionchange" transaction |
| 464 // * Once the connection is opened, the test runs: |
| 465 // #7: IndexedDBTransaction::Commit - the test's "readwrite" transaction) |
| 466 const int instance_num = 7; |
| 467 const int call_num = 1; |
| 468 FailOperation(FAIL_CLASS_LEVELDB_TRANSACTION, FAIL_METHOD_COMMIT_DISK_FULL, |
| 469 instance_num, call_num); |
| 470 SimpleTest(GetTestUrl("indexeddb", "disk_full_on_commit.html")); |
| 471 } |
| 472 |
| 444 namespace { | 473 namespace { |
| 445 | 474 |
| 446 static void CompactIndexedDBBackingStore( | 475 static void CompactIndexedDBBackingStore( |
| 447 scoped_refptr<IndexedDBContextImpl> context, | 476 scoped_refptr<IndexedDBContextImpl> context, |
| 448 const GURL& origin_url) { | 477 const GURL& origin_url) { |
| 449 IndexedDBFactory* factory = context->GetIDBFactory(); | 478 IndexedDBFactory* factory = context->GetIDBFactory(); |
| 450 | 479 |
| 451 std::pair<IndexedDBFactory::OriginDBMapIterator, | 480 std::pair<IndexedDBFactory::OriginDBMapIterator, |
| 452 IndexedDBFactory::OriginDBMapIterator> range = | 481 IndexedDBFactory::OriginDBMapIterator> range = |
| 453 factory->GetOpenDatabasesForOrigin(origin_url); | 482 factory->GetOpenDatabasesForOrigin(origin_url); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 command_line->AppendSwitch(switches::kSingleProcess); | 795 command_line->AppendSwitch(switches::kSingleProcess); |
| 767 } | 796 } |
| 768 }; | 797 }; |
| 769 | 798 |
| 770 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 799 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 771 RenderThreadShutdownTest) { | 800 RenderThreadShutdownTest) { |
| 772 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 801 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 773 } | 802 } |
| 774 | 803 |
| 775 } // namespace content | 804 } // namespace content |
| OLD | NEW |