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

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

Issue 320833002: [IndexedDB] Use consistent enums on both sides of IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 request, 132 request,
133 callbacks, 133 callbacks,
134 kFakeChildProcessId, 134 kFakeChildProcessId,
135 upgrade_transaction_id, 135 upgrade_transaction_id,
136 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION); 136 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
137 database->OpenConnection(connection); 137 database->OpenConnection(connection);
138 EXPECT_EQ(database, request->connection()->database()); 138 EXPECT_EQ(database, request->connection()->database());
139 139
140 const int64 transaction_id = 123; 140 const int64 transaction_id = 123;
141 const std::vector<int64> scope; 141 const std::vector<int64> scope;
142 database->CreateTransaction(transaction_id, 142 database->CreateTransaction(
143 request->connection(), 143 transaction_id, request->connection(), scope, blink::TransactionReadOnly);
144 scope,
145 indexed_db::TRANSACTION_READ_ONLY);
146 144
147 request->connection()->ForceClose(); 145 request->connection()->ForceClose();
148 146
149 EXPECT_TRUE(backing_store->HasOneRef()); // local 147 EXPECT_TRUE(backing_store->HasOneRef()); // local
150 EXPECT_TRUE(callbacks->abort_called()); 148 EXPECT_TRUE(callbacks->abort_called());
151 } 149 }
152 150
153 class MockDeleteCallbacks : public IndexedDBCallbacks { 151 class MockDeleteCallbacks : public IndexedDBCallbacks {
154 public: 152 public:
155 MockDeleteCallbacks() 153 MockDeleteCallbacks()
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 kFakeChildProcessId, 241 kFakeChildProcessId,
244 transaction_id, 242 transaction_id,
245 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION)); 243 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION));
246 EXPECT_EQ(IndexedDBDatabaseMetadata::NO_INT_VERSION, 244 EXPECT_EQ(IndexedDBDatabaseMetadata::NO_INT_VERSION,
247 db_->metadata().int_version); 245 db_->metadata().int_version);
248 246
249 transaction_ = new IndexedDBTransaction( 247 transaction_ = new IndexedDBTransaction(
250 transaction_id, 248 transaction_id,
251 callbacks_, 249 callbacks_,
252 std::set<int64>() /*scope*/, 250 std::set<int64>() /*scope*/,
253 indexed_db::TRANSACTION_VERSION_CHANGE, 251 blink::TransactionVersionChange,
254 db_, 252 db_,
255 new IndexedDBFakeBackingStore::FakeTransaction(commit_success_)); 253 new IndexedDBFakeBackingStore::FakeTransaction(commit_success_));
256 db_->TransactionCreated(transaction_); 254 db_->TransactionCreated(transaction_);
257 255
258 // Add a dummy task which takes the place of the VersionChangeOperation 256 // Add a dummy task which takes the place of the VersionChangeOperation
259 // which kicks off the upgrade. This ensures that the transaction has 257 // which kicks off the upgrade. This ensures that the transaction has
260 // processed at least one task before the CreateObjectStore call. 258 // processed at least one task before the CreateObjectStore call.
261 transaction_->ScheduleTask(base::Bind(&DummyOperation)); 259 transaction_->ScheduleTask(base::Bind(&DummyOperation));
262 } 260 }
263 261
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); 403 EXPECT_EQ(1ULL, db_->metadata().object_stores.size());
406 404
407 // This will execute the Put then Delete. 405 // This will execute the Put then Delete.
408 RunPostedTasks(); 406 RunPostedTasks();
409 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); 407 EXPECT_EQ(0ULL, db_->metadata().object_stores.size());
410 408
411 transaction_->Commit(); // Cleans up the object hierarchy. 409 transaction_->Commit(); // Cleans up the object hierarchy.
412 } 410 }
413 411
414 } // namespace content 412 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698