Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/indexed_db/indexed_db_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 EXPECT_TRUE(transaction2.CommitPhaseTwo().ok()); | 452 EXPECT_TRUE(transaction2.CommitPhaseTwo().ok()); |
| 453 EXPECT_EQ(m_value3.bits, result_value.bits); | 453 EXPECT_EQ(m_value3.bits, result_value.bits); |
| 454 EXPECT_TRUE(CheckBlobInfoMatches(result_value.blob_info)); | 454 EXPECT_TRUE(CheckBlobInfoMatches(result_value.blob_info)); |
| 455 EXPECT_TRUE(CheckBlobReadsMatchWrites(result_value.blob_info)); | 455 EXPECT_TRUE(CheckBlobReadsMatchWrites(result_value.blob_info)); |
| 456 } | 456 } |
| 457 | 457 |
| 458 { | 458 { |
| 459 IndexedDBBackingStore::Transaction transaction3(backing_store_.get()); | 459 IndexedDBBackingStore::Transaction transaction3(backing_store_.get()); |
| 460 transaction3.Begin(); | 460 transaction3.Begin(); |
| 461 IndexedDBValue result_value; | 461 IndexedDBValue result_value; |
| 462 EXPECT_TRUE(backing_store_->DeleteRange(&transaction3, | 462 EXPECT_TRUE( |
|
dmurph
2016/05/19 01:01:38
Do you want to put a check in here somewhere that
cmumford
2016/05/19 17:07:15
+1 dmurph's suggestion - also for the other calls
palakj1
2016/05/19 23:47:52
Added.
| |
| 463 1, | 463 backing_store_ |
| 464 1, | 464 ->DeleteRange(&transaction3, 1, 1, IndexedDBKeyRange(m_key3), NULL) |
| 465 IndexedDBKeyRange(m_key3)).ok()); | 465 .ok()); |
| 466 scoped_refptr<TestCallback> callback(new TestCallback()); | 466 scoped_refptr<TestCallback> callback(new TestCallback()); |
| 467 EXPECT_TRUE(transaction3.CommitPhaseOne(callback).ok()); | 467 EXPECT_TRUE(transaction3.CommitPhaseOne(callback).ok()); |
| 468 task_runner_->RunUntilIdle(); | 468 task_runner_->RunUntilIdle(); |
| 469 EXPECT_TRUE(callback->called); | 469 EXPECT_TRUE(callback->called); |
| 470 EXPECT_TRUE(callback->succeeded); | 470 EXPECT_TRUE(callback->succeeded); |
| 471 EXPECT_TRUE(transaction3.CommitPhaseTwo().ok()); | 471 EXPECT_TRUE(transaction3.CommitPhaseTwo().ok()); |
| 472 EXPECT_TRUE(CheckBlobRemovals()); | 472 EXPECT_TRUE(CheckBlobRemovals()); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 | 475 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 EXPECT_TRUE(callback->called); | 541 EXPECT_TRUE(callback->called); |
| 542 EXPECT_TRUE(callback->succeeded); | 542 EXPECT_TRUE(callback->succeeded); |
| 543 EXPECT_TRUE(transaction1.CommitPhaseTwo().ok()); | 543 EXPECT_TRUE(transaction1.CommitPhaseTwo().ok()); |
| 544 } | 544 } |
| 545 | 545 |
| 546 { | 546 { |
| 547 IndexedDBBackingStore::Transaction transaction2(backing_store_.get()); | 547 IndexedDBBackingStore::Transaction transaction2(backing_store_.get()); |
| 548 transaction2.Begin(); | 548 transaction2.Begin(); |
| 549 IndexedDBValue result_value; | 549 IndexedDBValue result_value; |
| 550 EXPECT_TRUE( | 550 EXPECT_TRUE( |
| 551 backing_store_->DeleteRange(&transaction2, 1, i + 1, ranges[i]).ok()); | 551 backing_store_->DeleteRange(&transaction2, 1, i + 1, ranges[i], NULL) |
| 552 .ok()); | |
| 552 scoped_refptr<TestCallback> callback(new TestCallback()); | 553 scoped_refptr<TestCallback> callback(new TestCallback()); |
| 553 EXPECT_TRUE(transaction2.CommitPhaseOne(callback).ok()); | 554 EXPECT_TRUE(transaction2.CommitPhaseOne(callback).ok()); |
| 554 task_runner_->RunUntilIdle(); | 555 task_runner_->RunUntilIdle(); |
| 555 EXPECT_TRUE(callback->called); | 556 EXPECT_TRUE(callback->called); |
| 556 EXPECT_TRUE(callback->succeeded); | 557 EXPECT_TRUE(callback->succeeded); |
| 557 EXPECT_TRUE(transaction2.CommitPhaseTwo().ok()); | 558 EXPECT_TRUE(transaction2.CommitPhaseTwo().ok()); |
| 558 EXPECT_EQ(2UL, backing_store_->removals().size()); | 559 EXPECT_EQ(2UL, backing_store_->removals().size()); |
| 559 EXPECT_EQ(backing_store_->writes()[1].key(), | 560 EXPECT_EQ(backing_store_->writes()[1].key(), |
| 560 backing_store_->removals()[0]); | 561 backing_store_->removals()[0]); |
| 561 EXPECT_EQ(backing_store_->writes()[2].key(), | 562 EXPECT_EQ(backing_store_->writes()[2].key(), |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 EXPECT_TRUE(callback->called); | 632 EXPECT_TRUE(callback->called); |
| 632 EXPECT_TRUE(callback->succeeded); | 633 EXPECT_TRUE(callback->succeeded); |
| 633 EXPECT_TRUE(transaction1.CommitPhaseTwo().ok()); | 634 EXPECT_TRUE(transaction1.CommitPhaseTwo().ok()); |
| 634 } | 635 } |
| 635 | 636 |
| 636 { | 637 { |
| 637 IndexedDBBackingStore::Transaction transaction2(backing_store_.get()); | 638 IndexedDBBackingStore::Transaction transaction2(backing_store_.get()); |
| 638 transaction2.Begin(); | 639 transaction2.Begin(); |
| 639 IndexedDBValue result_value; | 640 IndexedDBValue result_value; |
| 640 EXPECT_TRUE( | 641 EXPECT_TRUE( |
| 641 backing_store_->DeleteRange(&transaction2, 1, i + 1, ranges[i]).ok()); | 642 backing_store_->DeleteRange(&transaction2, 1, i + 1, ranges[i], NULL) |
| 643 .ok()); | |
| 642 scoped_refptr<TestCallback> callback(new TestCallback()); | 644 scoped_refptr<TestCallback> callback(new TestCallback()); |
| 643 EXPECT_TRUE(transaction2.CommitPhaseOne(callback).ok()); | 645 EXPECT_TRUE(transaction2.CommitPhaseOne(callback).ok()); |
| 644 task_runner_->RunUntilIdle(); | 646 task_runner_->RunUntilIdle(); |
| 645 EXPECT_TRUE(callback->called); | 647 EXPECT_TRUE(callback->called); |
| 646 EXPECT_TRUE(callback->succeeded); | 648 EXPECT_TRUE(callback->succeeded); |
| 647 EXPECT_TRUE(transaction2.CommitPhaseTwo().ok()); | 649 EXPECT_TRUE(transaction2.CommitPhaseTwo().ok()); |
| 648 EXPECT_EQ(0UL, backing_store_->removals().size()); | 650 EXPECT_EQ(0UL, backing_store_->removals().size()); |
| 649 } | 651 } |
| 650 } | 652 } |
| 651 } | 653 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 EXPECT_TRUE(CheckBlobInfoMatches(read_result_value.blob_info)); | 727 EXPECT_TRUE(CheckBlobInfoMatches(read_result_value.blob_info)); |
| 726 EXPECT_TRUE(CheckBlobReadsMatchWrites(read_result_value.blob_info)); | 728 EXPECT_TRUE(CheckBlobReadsMatchWrites(read_result_value.blob_info)); |
| 727 for (size_t i = 0; i < read_result_value.blob_info.size(); ++i) { | 729 for (size_t i = 0; i < read_result_value.blob_info.size(); ++i) { |
| 728 read_result_value.blob_info[i].mark_used_callback().Run(); | 730 read_result_value.blob_info[i].mark_used_callback().Run(); |
| 729 } | 731 } |
| 730 } | 732 } |
| 731 | 733 |
| 732 { | 734 { |
| 733 IndexedDBBackingStore::Transaction transaction3(backing_store_.get()); | 735 IndexedDBBackingStore::Transaction transaction3(backing_store_.get()); |
| 734 transaction3.Begin(); | 736 transaction3.Begin(); |
| 735 EXPECT_TRUE(backing_store_->DeleteRange(&transaction3, | 737 EXPECT_TRUE( |
| 736 1, | 738 backing_store_ |
| 737 1, | 739 ->DeleteRange(&transaction3, 1, 1, IndexedDBKeyRange(m_key3), NULL) |
| 738 IndexedDBKeyRange(m_key3)).ok()); | 740 .ok()); |
| 739 scoped_refptr<TestCallback> callback(new TestCallback()); | 741 scoped_refptr<TestCallback> callback(new TestCallback()); |
| 740 EXPECT_TRUE(transaction3.CommitPhaseOne(callback).ok()); | 742 EXPECT_TRUE(transaction3.CommitPhaseOne(callback).ok()); |
| 741 task_runner_->RunUntilIdle(); | 743 task_runner_->RunUntilIdle(); |
| 742 EXPECT_TRUE(callback->called); | 744 EXPECT_TRUE(callback->called); |
| 743 EXPECT_TRUE(callback->succeeded); | 745 EXPECT_TRUE(callback->succeeded); |
| 744 EXPECT_TRUE(transaction3.CommitPhaseTwo().ok()); | 746 EXPECT_TRUE(transaction3.CommitPhaseTwo().ok()); |
| 745 EXPECT_EQ(0U, backing_store_->removals().size()); | 747 EXPECT_EQ(0U, backing_store_->removals().size()); |
| 746 for (size_t i = 0; i < read_result_value.blob_info.size(); ++i) { | 748 for (size_t i = 0; i < read_result_value.blob_info.size(); ++i) { |
| 747 read_result_value.blob_info[i].release_callback().Run( | 749 read_result_value.blob_info[i].release_callback().Run( |
| 748 read_result_value.blob_info[i].file_path()); | 750 read_result_value.blob_info[i].file_path()); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1041 | 1043 |
| 1042 std::vector<base::string16> names = backing_store_->GetDatabaseNames(&s); | 1044 std::vector<base::string16> names = backing_store_->GetDatabaseNames(&s); |
| 1043 EXPECT_TRUE(s.ok()); | 1045 EXPECT_TRUE(s.ok()); |
| 1044 EXPECT_EQ(names.size(), 1ULL); | 1046 EXPECT_EQ(names.size(), 1ULL); |
| 1045 EXPECT_EQ(names[0], db1_name); | 1047 EXPECT_EQ(names[0], db1_name); |
| 1046 } | 1048 } |
| 1047 | 1049 |
| 1048 } // namespace | 1050 } // namespace |
| 1049 | 1051 |
| 1050 } // namespace content | 1052 } // namespace content |
| OLD | NEW |