| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_transaction.h" | 5 #include "content/browser/indexed_db/indexed_db_transaction.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 IndexedDBTransactionTest() : factory_(new MockIndexedDBFactory()) { | 41 IndexedDBTransactionTest() : factory_(new MockIndexedDBFactory()) { |
| 42 backing_store_ = new IndexedDBFakeBackingStore(); | 42 backing_store_ = new IndexedDBFakeBackingStore(); |
| 43 CreateDB(); | 43 CreateDB(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void CreateDB() { | 46 void CreateDB() { |
| 47 // DB is created here instead of the constructor to workaround a | 47 // DB is created here instead of the constructor to workaround a |
| 48 // "peculiarity of C++". More info at | 48 // "peculiarity of C++". More info at |
| 49 // https://github.com/google/googletest/blob/master/googletest/docs/FAQ.md#m
y-compiler-complains-that-a-constructor-or-destructor-cannot-return-a-value-what
s-going-on | 49 // https://github.com/google/googletest/blob/master/googletest/docs/FAQ.md#m
y-compiler-complains-that-a-constructor-or-destructor-cannot-return-a-value-what
s-going-on |
| 50 leveldb::Status s; | 50 leveldb::Status s; |
| 51 db_ = IndexedDBDatabase::Create(base::ASCIIToUTF16("db"), | 51 std::tie(db_, s) = IndexedDBDatabase::Create( |
| 52 backing_store_.get(), | 52 base::ASCIIToUTF16("db"), backing_store_.get(), factory_.get(), |
| 53 factory_.get(), | 53 IndexedDBDatabase::Identifier()); |
| 54 IndexedDBDatabase::Identifier(), | |
| 55 &s); | |
| 56 ASSERT_TRUE(s.ok()); | 54 ASSERT_TRUE(s.ok()); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void RunPostedTasks() { base::RunLoop().RunUntilIdle(); } | 57 void RunPostedTasks() { base::RunLoop().RunUntilIdle(); } |
| 60 void DummyOperation(IndexedDBTransaction* transaction) {} | 58 void DummyOperation(IndexedDBTransaction* transaction) {} |
| 61 void AbortableOperation(AbortObserver* observer, | 59 void AbortableOperation(AbortObserver* observer, |
| 62 IndexedDBTransaction* transaction) { | 60 IndexedDBTransaction* transaction) { |
| 63 transaction->ScheduleAbortTask( | 61 transaction->ScheduleAbortTask( |
| 64 base::Bind(&AbortObserver::AbortTask, base::Unretained(observer))); | 62 base::Bind(&AbortObserver::AbortTask, base::Unretained(observer))); |
| 65 } | 63 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 405 |
| 408 static const blink::WebIDBTransactionMode kTestModes[] = { | 406 static const blink::WebIDBTransactionMode kTestModes[] = { |
| 409 blink::WebIDBTransactionModeReadOnly, blink::WebIDBTransactionModeReadWrite, | 407 blink::WebIDBTransactionModeReadOnly, blink::WebIDBTransactionModeReadWrite, |
| 410 blink::WebIDBTransactionModeVersionChange}; | 408 blink::WebIDBTransactionModeVersionChange}; |
| 411 | 409 |
| 412 INSTANTIATE_TEST_CASE_P(IndexedDBTransactions, | 410 INSTANTIATE_TEST_CASE_P(IndexedDBTransactions, |
| 413 IndexedDBTransactionTestMode, | 411 IndexedDBTransactionTestMode, |
| 414 ::testing::ValuesIn(kTestModes)); | 412 ::testing::ValuesIn(kTestModes)); |
| 415 | 413 |
| 416 } // namespace content | 414 } // namespace content |
| OLD | NEW |