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

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

Issue 2566693004: Fix TestBrowserThreadBundle destruction order in IndexedDBDatabaseOperationTest. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 db_->TransactionCreated(transaction_); 370 db_->TransactionCreated(transaction_);
371 371
372 // Add a dummy task which takes the place of the VersionChangeOperation 372 // Add a dummy task which takes the place of the VersionChangeOperation
373 // which kicks off the upgrade. This ensures that the transaction has 373 // which kicks off the upgrade. This ensures that the transaction has
374 // processed at least one task before the CreateObjectStore call. 374 // processed at least one task before the CreateObjectStore call.
375 transaction_->ScheduleTask(base::Bind(&DummyOperation)); 375 transaction_->ScheduleTask(base::Bind(&DummyOperation));
376 } 376 }
377 377
378 void RunPostedTasks() { base::RunLoop().RunUntilIdle(); } 378 void RunPostedTasks() { base::RunLoop().RunUntilIdle(); }
379 379
380 private:
381 // Needs to outlive |db_|.
382 content::TestBrowserThreadBundle thread_bundle_;
383
380 protected: 384 protected:
381 scoped_refptr<IndexedDBFakeBackingStore> backing_store_; 385 scoped_refptr<IndexedDBFakeBackingStore> backing_store_;
382 scoped_refptr<IndexedDBDatabase> db_; 386 scoped_refptr<IndexedDBDatabase> db_;
383 scoped_refptr<MockIndexedDBCallbacks> request_; 387 scoped_refptr<MockIndexedDBCallbacks> request_;
384 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks_; 388 scoped_refptr<MockIndexedDBDatabaseCallbacks> callbacks_;
385 IndexedDBTransaction* transaction_; 389 IndexedDBTransaction* transaction_;
386 std::unique_ptr<IndexedDBConnection> connection_; 390 std::unique_ptr<IndexedDBConnection> connection_;
387 391
388 leveldb::Status commit_success_; 392 leveldb::Status commit_success_;
389 393
390 private: 394 private:
391 scoped_refptr<MockIndexedDBFactory> factory_; 395 scoped_refptr<MockIndexedDBFactory> factory_;
392 content::TestBrowserThreadBundle thread_bundle_;
393 396
394 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabaseOperationTest); 397 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabaseOperationTest);
395 }; 398 };
396 399
397 TEST_F(IndexedDBDatabaseOperationTest, CreateObjectStore) { 400 TEST_F(IndexedDBDatabaseOperationTest, CreateObjectStore) {
398 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); 401 EXPECT_EQ(0ULL, db_->metadata().object_stores.size());
399 const int64_t store_id = 1001; 402 const int64_t store_id = 1001;
400 db_->CreateObjectStore(transaction_, store_id, ASCIIToUTF16("store"), 403 db_->CreateObjectStore(transaction_, store_id, ASCIIToUTF16("store"),
401 IndexedDBKeyPath(), false /*auto_increment*/); 404 IndexedDBKeyPath(), false /*auto_increment*/);
402 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); 405 EXPECT_EQ(1ULL, db_->metadata().object_stores.size());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); 492 EXPECT_EQ(1ULL, db_->metadata().object_stores.size());
490 493
491 // This will execute the Put then Delete. 494 // This will execute the Put then Delete.
492 RunPostedTasks(); 495 RunPostedTasks();
493 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); 496 EXPECT_EQ(0ULL, db_->metadata().object_stores.size());
494 497
495 transaction_->Commit(); // Cleans up the object hierarchy. 498 transaction_->Commit(); // Cleans up the object hierarchy.
496 } 499 }
497 500
498 } // namespace content 501 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698