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

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

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expected test results changed Created 4 years, 5 months 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
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 <stdint.h> 7 #include <stdint.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 ASSERT_TRUE(s.ok()); 231 ASSERT_TRUE(s.ok());
232 232
233 request_ = new MockIndexedDBCallbacks(); 233 request_ = new MockIndexedDBCallbacks();
234 callbacks_ = new MockIndexedDBDatabaseCallbacks(); 234 callbacks_ = new MockIndexedDBDatabaseCallbacks();
235 const int64_t transaction_id = 1; 235 const int64_t transaction_id = 1;
236 db_->OpenConnection(IndexedDBPendingConnection( 236 db_->OpenConnection(IndexedDBPendingConnection(
237 request_, callbacks_, kFakeChildProcessId, transaction_id, 237 request_, callbacks_, kFakeChildProcessId, transaction_id,
238 IndexedDBDatabaseMetadata::DEFAULT_VERSION)); 238 IndexedDBDatabaseMetadata::DEFAULT_VERSION));
239 EXPECT_EQ(IndexedDBDatabaseMetadata::NO_VERSION, db_->metadata().version); 239 EXPECT_EQ(IndexedDBDatabaseMetadata::NO_VERSION, db_->metadata().version);
240 240
241 std::unique_ptr<IndexedDBConnection> connection_(
cmumford 2016/07/01 18:35:00 connection_ is a local variable (not a class membe
palakj1 2016/07/02 00:48:13 Thanks for pointing that out. Turned connection to
242 new IndexedDBConnection(db_, callbacks_));
241 transaction_ = IndexedDBClassFactory::Get()->CreateIndexedDBTransaction( 243 transaction_ = IndexedDBClassFactory::Get()->CreateIndexedDBTransaction(
242 transaction_id, callbacks_, std::set<int64_t>() /*scope*/, 244 transaction_id, connection_->GetWeakPtr(),
243 blink::WebIDBTransactionModeVersionChange, db_.get(), 245 std::set<int64_t>() /*scope*/,
246 blink::WebIDBTransactionModeVersionChange,
244 new IndexedDBFakeBackingStore::FakeTransaction(commit_success_)); 247 new IndexedDBFakeBackingStore::FakeTransaction(commit_success_));
245 db_->TransactionCreated(transaction_.get()); 248 db_->TransactionCreated(transaction_.get());
246 249
247 // Add a dummy task which takes the place of the VersionChangeOperation 250 // Add a dummy task which takes the place of the VersionChangeOperation
248 // which kicks off the upgrade. This ensures that the transaction has 251 // which kicks off the upgrade. This ensures that the transaction has
249 // processed at least one task before the CreateObjectStore call. 252 // processed at least one task before the CreateObjectStore call.
250 transaction_->ScheduleTask(base::Bind(&DummyOperation)); 253 transaction_->ScheduleTask(base::Bind(&DummyOperation));
251 } 254 }
252 255
253 void RunPostedTasks() { base::RunLoop().RunUntilIdle(); } 256 void RunPostedTasks() { base::RunLoop().RunUntilIdle(); }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); 392 EXPECT_EQ(1ULL, db_->metadata().object_stores.size());
390 393
391 // This will execute the Put then Delete. 394 // This will execute the Put then Delete.
392 RunPostedTasks(); 395 RunPostedTasks();
393 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); 396 EXPECT_EQ(0ULL, db_->metadata().object_stores.size());
394 397
395 transaction_->Commit(); // Cleans up the object hierarchy. 398 transaction_->Commit(); // Cleans up the object hierarchy.
396 } 399 }
397 400
398 } // namespace content 401 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698