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_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.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.h" | 11 #include "content/browser/indexed_db/indexed_db.h" |
12 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 12 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
13 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 13 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
14 #include "content/browser/indexed_db/indexed_db_connection.h" | 14 #include "content/browser/indexed_db/indexed_db_connection.h" |
15 #include "content/browser/indexed_db/indexed_db_cursor.h" | 15 #include "content/browser/indexed_db/indexed_db_cursor.h" |
16 #include "content/browser/indexed_db/indexed_db_database.h" | 16 #include "content/browser/indexed_db/indexed_db_database.h" |
17 #include "content/browser/indexed_db/indexed_db_factory.h" | 17 #include "content/browser/indexed_db/indexed_db_factory.h" |
18 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" | 18 #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" |
19 #include "content/browser/indexed_db/indexed_db_transaction.h" | 19 #include "content/browser/indexed_db/indexed_db_transaction.h" |
20 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" | 20 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" |
21 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" | 21 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
| 24 using base::ASCIIToUTF16; |
| 25 |
24 namespace content { | 26 namespace content { |
25 | 27 |
26 TEST(IndexedDBDatabaseTest, BackingStoreRetention) { | 28 TEST(IndexedDBDatabaseTest, BackingStoreRetention) { |
27 scoped_refptr<IndexedDBFakeBackingStore> backing_store = | 29 scoped_refptr<IndexedDBFakeBackingStore> backing_store = |
28 new IndexedDBFakeBackingStore(); | 30 new IndexedDBFakeBackingStore(); |
29 EXPECT_TRUE(backing_store->HasOneRef()); | 31 EXPECT_TRUE(backing_store->HasOneRef()); |
30 | 32 |
31 IndexedDBFactory* factory = 0; | 33 IndexedDBFactory* factory = 0; |
32 scoped_refptr<IndexedDBDatabase> db = IndexedDBDatabase::Create( | 34 scoped_refptr<IndexedDBDatabase> db = IndexedDBDatabase::Create( |
33 ASCIIToUTF16("db"), | 35 ASCIIToUTF16("db"), |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 EXPECT_TRUE(request2->blocked_called()); | 180 EXPECT_TRUE(request2->blocked_called()); |
179 EXPECT_FALSE(backing_store->HasOneRef()); // local and db | 181 EXPECT_FALSE(backing_store->HasOneRef()); // local and db |
180 | 182 |
181 db->Close(request1->connection(), true /* forced */); | 183 db->Close(request1->connection(), true /* forced */); |
182 | 184 |
183 EXPECT_FALSE(db->backing_store()); | 185 EXPECT_FALSE(db->backing_store()); |
184 EXPECT_TRUE(backing_store->HasOneRef()); // local | 186 EXPECT_TRUE(backing_store->HasOneRef()); // local |
185 } | 187 } |
186 | 188 |
187 } // namespace content | 189 } // namespace content |
OLD | NEW |