Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: content/browser/indexed_db/indexed_db_database_unittest.cc

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use ScopedVector and stl_utils for BlobDataHandles. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 IndexedDBDatabase::Identifier()); 52 IndexedDBDatabase::Identifier());
53 53
54 EXPECT_FALSE(backing_store->HasOneRef()); // local and db 54 EXPECT_FALSE(backing_store->HasOneRef()); // local and db
55 55
56 scoped_refptr<MockIndexedDBCallbacks> request1(new MockIndexedDBCallbacks()); 56 scoped_refptr<MockIndexedDBCallbacks> request1(new MockIndexedDBCallbacks());
57 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks1( 57 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks1(
58 new MockIndexedDBDatabaseCallbacks()); 58 new MockIndexedDBDatabaseCallbacks());
59 const int64 transaction_id1 = 1; 59 const int64 transaction_id1 = 1;
60 db->OpenConnection(request1, 60 db->OpenConnection(request1,
61 callbacks1, 61 callbacks1,
62 0 /* fake child_process_id */,
62 transaction_id1, 63 transaction_id1,
63 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); 64 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
64 65
65 EXPECT_FALSE(backing_store->HasOneRef()); // db, connection count > 0 66 EXPECT_FALSE(backing_store->HasOneRef()); // db, connection count > 0
66 67
67 scoped_refptr<MockIndexedDBCallbacks> request2(new MockIndexedDBCallbacks()); 68 scoped_refptr<MockIndexedDBCallbacks> request2(new MockIndexedDBCallbacks());
68 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks2( 69 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks2(
69 new MockIndexedDBDatabaseCallbacks()); 70 new MockIndexedDBDatabaseCallbacks());
70 const int64 transaction_id2 = 2; 71 const int64 transaction_id2 = 2;
71 db->OpenConnection(request2, 72 db->OpenConnection(request2,
72 callbacks2, 73 callbacks2,
74 0 /* fake child_process_id */,
73 transaction_id2, 75 transaction_id2,
74 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); 76 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
75 77
76 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection 78 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection
77 79
78 request1->connection()->ForceClose(); 80 request1->connection()->ForceClose();
79 EXPECT_FALSE(request1->connection()->IsConnected()); 81 EXPECT_FALSE(request1->connection()->IsConnected());
80 82
81 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection 83 EXPECT_FALSE(backing_store->HasOneRef()); // local and connection
82 84
(...skipping 19 matching lines...) Expand all
102 IndexedDBDatabase::Identifier()); 104 IndexedDBDatabase::Identifier());
103 105
104 EXPECT_FALSE(backing_store->HasOneRef()); // local and db 106 EXPECT_FALSE(backing_store->HasOneRef()); // local and db
105 107
106 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks( 108 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks(
107 new MockIndexedDBDatabaseCallbacks()); 109 new MockIndexedDBDatabaseCallbacks());
108 scoped_refptr<MockIndexedDBCallbacks> request(new MockIndexedDBCallbacks()); 110 scoped_refptr<MockIndexedDBCallbacks> request(new MockIndexedDBCallbacks());
109 const int64 upgrade_transaction_id = 3; 111 const int64 upgrade_transaction_id = 3;
110 database->OpenConnection(request, 112 database->OpenConnection(request,
111 callbacks, 113 callbacks,
114 0 /* fake child_process_id */,
112 upgrade_transaction_id, 115 upgrade_transaction_id,
113 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); 116 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
114 EXPECT_EQ(database, request->connection()->database()); 117 EXPECT_EQ(database, request->connection()->database());
115 118
116 const int64 transaction_id = 123; 119 const int64 transaction_id = 123;
117 const std::vector<int64> scope; 120 const std::vector<int64> scope;
118 database->CreateTransaction(transaction_id, 121 database->CreateTransaction(transaction_id,
119 request->connection(), 122 request->connection(),
120 scope, 123 scope,
121 indexed_db::TRANSACTION_READ_ONLY); 124 indexed_db::TRANSACTION_READ_ONLY);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 IndexedDBDatabase::Identifier()); 163 IndexedDBDatabase::Identifier());
161 164
162 EXPECT_FALSE(backing_store->HasOneRef()); // local and db 165 EXPECT_FALSE(backing_store->HasOneRef()); // local and db
163 166
164 scoped_refptr<MockIndexedDBCallbacks> request1(new MockIndexedDBCallbacks()); 167 scoped_refptr<MockIndexedDBCallbacks> request1(new MockIndexedDBCallbacks());
165 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks1( 168 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks1(
166 new MockIndexedDBDatabaseCallbacks()); 169 new MockIndexedDBDatabaseCallbacks());
167 const int64 transaction_id1 = 1; 170 const int64 transaction_id1 = 1;
168 db->OpenConnection(request1, 171 db->OpenConnection(request1,
169 callbacks1, 172 callbacks1,
173 0 /* fake child_process_id */,
170 transaction_id1, 174 transaction_id1,
171 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); 175 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
172 176
173 EXPECT_FALSE(backing_store->HasOneRef()); // local and db 177 EXPECT_FALSE(backing_store->HasOneRef()); // local and db
174 178
175 scoped_refptr<MockDeleteCallbacks> request2(new MockDeleteCallbacks()); 179 scoped_refptr<MockDeleteCallbacks> request2(new MockDeleteCallbacks());
176 db->DeleteDatabase(request2); 180 db->DeleteDatabase(request2);
177 181
178 EXPECT_TRUE(request2->blocked_called()); 182 EXPECT_TRUE(request2->blocked_called());
179 EXPECT_FALSE(backing_store->HasOneRef()); // local and db 183 EXPECT_FALSE(backing_store->HasOneRef()); // local and db
180 184
181 db->Close(request1->connection(), true /* forced */); 185 db->Close(request1->connection(), true /* forced */);
182 186
183 EXPECT_FALSE(db->backing_store()); 187 EXPECT_FALSE(db->backing_store());
184 EXPECT_TRUE(backing_store->HasOneRef()); // local 188 EXPECT_TRUE(backing_store->HasOneRef()); // local
185 } 189 }
186 190
187 } // namespace content 191 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698