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

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: Incorporated review comments. 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(transaction_id,
143 request->connection(), 143 request->connection(),
144 scope, 144 scope,
145 indexed_db::TRANSACTION_READ_ONLY); 145 blink::WebIDBTransactionModeReadOnly);
146 146
147 request->connection()->ForceClose(); 147 request->connection()->ForceClose();
148 148
149 EXPECT_TRUE(backing_store->HasOneRef()); // local 149 EXPECT_TRUE(backing_store->HasOneRef()); // local
150 EXPECT_TRUE(callbacks->abort_called()); 150 EXPECT_TRUE(callbacks->abort_called());
151 } 151 }
152 152
153 class MockDeleteCallbacks : public IndexedDBCallbacks { 153 class MockDeleteCallbacks : public IndexedDBCallbacks {
154 public: 154 public:
155 MockDeleteCallbacks() 155 MockDeleteCallbacks()
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 kFakeChildProcessId, 243 kFakeChildProcessId,
244 transaction_id, 244 transaction_id,
245 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION)); 245 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION));
246 EXPECT_EQ(IndexedDBDatabaseMetadata::NO_INT_VERSION, 246 EXPECT_EQ(IndexedDBDatabaseMetadata::NO_INT_VERSION,
247 db_->metadata().int_version); 247 db_->metadata().int_version);
248 248
249 transaction_ = new IndexedDBTransaction( 249 transaction_ = new IndexedDBTransaction(
250 transaction_id, 250 transaction_id,
251 callbacks_, 251 callbacks_,
252 std::set<int64>() /*scope*/, 252 std::set<int64>() /*scope*/,
253 indexed_db::TRANSACTION_VERSION_CHANGE, 253 blink::WebIDBTransactionModeVersionChange,
254 db_, 254 db_,
255 new IndexedDBFakeBackingStore::FakeTransaction(commit_success_)); 255 new IndexedDBFakeBackingStore::FakeTransaction(commit_success_));
256 db_->TransactionCreated(transaction_); 256 db_->TransactionCreated(transaction_);
257 257
258 // Add a dummy task which takes the place of the VersionChangeOperation 258 // Add a dummy task which takes the place of the VersionChangeOperation
259 // which kicks off the upgrade. This ensures that the transaction has 259 // which kicks off the upgrade. This ensures that the transaction has
260 // processed at least one task before the CreateObjectStore call. 260 // processed at least one task before the CreateObjectStore call.
261 transaction_->ScheduleTask(base::Bind(&DummyOperation)); 261 transaction_->ScheduleTask(base::Bind(&DummyOperation));
262 } 262 }
263 263
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 ScopedVector<webkit_blob::BlobDataHandle> handles; 388 ScopedVector<webkit_blob::BlobDataHandle> handles;
389 scoped_ptr<IndexedDBKey> key(new IndexedDBKey("key")); 389 scoped_ptr<IndexedDBKey> key(new IndexedDBKey("key"));
390 std::vector<IndexedDBDatabase::IndexKeys> index_keys; 390 std::vector<IndexedDBDatabase::IndexKeys> index_keys;
391 scoped_refptr<MockIndexedDBCallbacks> request( 391 scoped_refptr<MockIndexedDBCallbacks> request(
392 new MockIndexedDBCallbacks(false)); 392 new MockIndexedDBCallbacks(false));
393 db_->Put(transaction_->id(), 393 db_->Put(transaction_->id(),
394 store_id, 394 store_id,
395 &value, 395 &value,
396 &handles, 396 &handles,
397 key.Pass(), 397 key.Pass(),
398 IndexedDBDatabase::ADD_ONLY, 398 blink::WebIDBPutModeAddOnly,
399 request, 399 request,
400 index_keys); 400 index_keys);
401 401
402 // Deletion is asynchronous. 402 // Deletion is asynchronous.
403 db_->DeleteObjectStore(transaction_->id(), 403 db_->DeleteObjectStore(transaction_->id(),
404 store_id); 404 store_id);
405 EXPECT_EQ(1ULL, db_->metadata().object_stores.size()); 405 EXPECT_EQ(1ULL, db_->metadata().object_stores.size());
406 406
407 // This will execute the Put then Delete. 407 // This will execute the Put then Delete.
408 RunPostedTasks(); 408 RunPostedTasks();
409 EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); 409 EXPECT_EQ(0ULL, db_->metadata().object_stores.size());
410 410
411 transaction_->Commit(); // Cleans up the object hierarchy. 411 transaction_->Commit(); // Cleans up the object hierarchy.
412 } 412 }
413 413
414 } // namespace content 414 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698