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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" | 11 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" |
12 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" | 12 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class IndexedDBTransactionTest : public testing::Test { | 17 class IndexedDBTransactionTest : public testing::Test { |
18 public: | 18 public: |
19 IndexedDBTransactionTest() { | 19 IndexedDBTransactionTest() { |
20 backing_store_ = new IndexedDBFakeBackingStore(); | |
21 CreateDB(); | |
22 } | |
23 | |
24 void CreateDB() { | |
25 // DB is created here instead of the constructor to workaround a | |
jsbell
2014/04/15 17:48:45
I think you can shorten the comment a bit, e.g. 'C
| |
26 // "peculiarity of C++". More info at | |
27 // https://code.google.com/p/googletest/wiki/FAQ#My_compiler_complains_that_ a_constructor_(or_destructor)_cannot | |
20 IndexedDBFactory* factory = NULL; | 28 IndexedDBFactory* factory = NULL; |
21 backing_store_ = new IndexedDBFakeBackingStore(); | 29 leveldb::Status s; |
22 db_ = IndexedDBDatabase::Create(base::ASCIIToUTF16("db"), | 30 db_ = IndexedDBDatabase::Create(base::ASCIIToUTF16("db"), |
23 backing_store_, | 31 backing_store_, |
24 factory, | 32 factory, |
25 IndexedDBDatabase::Identifier()); | 33 IndexedDBDatabase::Identifier(), |
34 &s); | |
35 ASSERT_TRUE(s.ok()); | |
26 } | 36 } |
27 | 37 |
28 void RunPostedTasks() { message_loop_.RunUntilIdle(); } | 38 void RunPostedTasks() { message_loop_.RunUntilIdle(); } |
29 void DummyOperation(IndexedDBTransaction* transaction) {} | 39 void DummyOperation(IndexedDBTransaction* transaction) {} |
30 | 40 |
31 protected: | 41 protected: |
32 scoped_refptr<IndexedDBFakeBackingStore> backing_store_; | 42 scoped_refptr<IndexedDBFakeBackingStore> backing_store_; |
33 scoped_refptr<IndexedDBDatabase> db_; | 43 scoped_refptr<IndexedDBDatabase> db_; |
34 | 44 |
35 private: | 45 private: |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 indexed_db::TRANSACTION_READ_ONLY, | 293 indexed_db::TRANSACTION_READ_ONLY, |
284 indexed_db::TRANSACTION_READ_WRITE, | 294 indexed_db::TRANSACTION_READ_WRITE, |
285 indexed_db::TRANSACTION_VERSION_CHANGE | 295 indexed_db::TRANSACTION_VERSION_CHANGE |
286 }; | 296 }; |
287 | 297 |
288 INSTANTIATE_TEST_CASE_P(IndexedDBTransactions, | 298 INSTANTIATE_TEST_CASE_P(IndexedDBTransactions, |
289 IndexedDBTransactionTestMode, | 299 IndexedDBTransactionTestMode, |
290 ::testing::ValuesIn(kTestModes)); | 300 ::testing::ValuesIn(kTestModes)); |
291 | 301 |
292 } // namespace content | 302 } // namespace content |
OLD | NEW |