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 <gtest/gtest.h> | 7 #include <gtest/gtest.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 | 109 |
110 EXPECT_FALSE(backing_store->HasOneRef()); // local and db | 110 EXPECT_FALSE(backing_store->HasOneRef()); // local and db |
111 | 111 |
112 scoped_refptr<MockIDBCallbacks> request1 = MockIDBCallbacks::Create(); | 112 scoped_refptr<MockIDBCallbacks> request1 = MockIDBCallbacks::Create(); |
113 scoped_refptr<FakeIDBDatabaseCallbacks> connection1 = | 113 scoped_refptr<FakeIDBDatabaseCallbacks> connection1 = |
114 FakeIDBDatabaseCallbacks::Create(); | 114 FakeIDBDatabaseCallbacks::Create(); |
115 const int64 transaction_id1 = 1; | 115 const int64 transaction_id1 = 1; |
116 db->OpenConnection(request1, | 116 db->OpenConnection(request1, |
117 connection1, | 117 connection1, |
118 transaction_id1, | 118 transaction_id1, |
119 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); | 119 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION, |
120 false); | |
jsbell
2013/06/14 20:42:58
Give the argument a default value instead of passi
dgrogan
2013/06/14 22:06:43
jar@ recently reminded me that default arguments a
| |
120 | 121 |
121 EXPECT_FALSE(backing_store->HasOneRef()); // db, connection count > 0 | 122 EXPECT_FALSE(backing_store->HasOneRef()); // db, connection count > 0 |
122 | 123 |
123 scoped_refptr<MockIDBCallbacks> request2 = MockIDBCallbacks::Create(); | 124 scoped_refptr<MockIDBCallbacks> request2 = MockIDBCallbacks::Create(); |
124 scoped_refptr<FakeIDBDatabaseCallbacks> connection2 = | 125 scoped_refptr<FakeIDBDatabaseCallbacks> connection2 = |
125 FakeIDBDatabaseCallbacks::Create(); | 126 FakeIDBDatabaseCallbacks::Create(); |
126 const int64 transaction_id2 = 2; | 127 const int64 transaction_id2 = 2; |
127 db->OpenConnection(request2, | 128 db->OpenConnection(request2, |
128 connection2, | 129 connection2, |
129 transaction_id2, | 130 transaction_id2, |
130 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); | 131 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION, |
132 false); | |
jsbell
2013/06/14 20:42:58
Ditto?
dgrogan
2013/06/14 22:06:43
Done.
| |
131 | 133 |
132 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection | 134 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection |
133 | 135 |
134 db->Close(connection1); | 136 db->Close(connection1); |
135 | 137 |
136 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection | 138 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection |
137 | 139 |
138 db->Close(connection2); | 140 db->Close(connection2); |
139 EXPECT_TRUE(backing_store->HasOneRef()); | 141 EXPECT_TRUE(backing_store->HasOneRef()); |
140 EXPECT_FALSE(db->BackingStore().get()); | 142 EXPECT_FALSE(db->BackingStore().get()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 180 |
179 scoped_refptr<MockIDBDatabaseCallbacks> connection = | 181 scoped_refptr<MockIDBDatabaseCallbacks> connection = |
180 MockIDBDatabaseCallbacks::Create(); | 182 MockIDBDatabaseCallbacks::Create(); |
181 WebIDBDatabaseImpl web_database(backend, connection); | 183 WebIDBDatabaseImpl web_database(backend, connection); |
182 | 184 |
183 scoped_refptr<MockIDBCallbacks> request = MockIDBCallbacks::Create(); | 185 scoped_refptr<MockIDBCallbacks> request = MockIDBCallbacks::Create(); |
184 const int64 upgrade_transaction_id = 3; | 186 const int64 upgrade_transaction_id = 3; |
185 backend->OpenConnection(request, | 187 backend->OpenConnection(request, |
186 connection, | 188 connection, |
187 upgrade_transaction_id, | 189 upgrade_transaction_id, |
188 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); | 190 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION, |
191 false); | |
jsbell
2013/06/14 20:42:58
Ditto?
dgrogan
2013/06/14 22:06:43
Done.
| |
189 | 192 |
190 const int64 transaction_id = 123; | 193 const int64 transaction_id = 123; |
191 const std::vector<int64> scope; | 194 const std::vector<int64> scope; |
192 web_database.createTransaction( | 195 web_database.createTransaction( |
193 transaction_id, 0, scope, indexed_db::TRANSACTION_READ_ONLY); | 196 transaction_id, 0, scope, indexed_db::TRANSACTION_READ_ONLY); |
194 | 197 |
195 web_database.forceClose(); | 198 web_database.forceClose(); |
196 | 199 |
197 EXPECT_TRUE(backing_store->HasOneRef()); // local | 200 EXPECT_TRUE(backing_store->HasOneRef()); // local |
198 } | 201 } |
199 | 202 |
200 } // namespace content | 203 } // namespace content |
OLD | NEW |