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

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

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle the rest of Josh's feedback. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/indexed_db/indexed_db_connection.h" 10 #include "content/browser/indexed_db/indexed_db_connection.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 temp_dir.path(), special_storage_policy_, NULL, task_runner_); 233 temp_dir.path(), special_storage_policy_, NULL, task_runner_);
234 234
235 scoped_refptr<IndexedDBFactory> factory = context->GetIDBFactory(); 235 scoped_refptr<IndexedDBFactory> factory = context->GetIDBFactory();
236 236
237 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks()); 237 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks());
238 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks( 238 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks(
239 new MockIndexedDBDatabaseCallbacks()); 239 new MockIndexedDBDatabaseCallbacks());
240 const int64 transaction_id = 1; 240 const int64 transaction_id = 1;
241 factory->Open(ASCIIToUTF16("db"), 241 factory->Open(ASCIIToUTF16("db"),
242 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION, 242 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION,
243 NULL, /* request_context */
243 transaction_id, 244 transaction_id,
244 callbacks, 245 callbacks,
245 db_callbacks, 246 db_callbacks,
246 kTestOrigin, 247 kTestOrigin,
247 temp_dir.path()); 248 temp_dir.path(),
249 0, /* child_process_id */
250 task_runner_ /* task_runner */);
248 251
249 EXPECT_TRUE(callbacks->connection()); 252 EXPECT_TRUE(callbacks->connection());
250 253
251 // ConnectionOpened() is usually called by the dispatcher. 254 // ConnectionOpened() is usually called by the dispatcher.
252 context->ConnectionOpened(kTestOrigin, callbacks->connection()); 255 context->ConnectionOpened(kTestOrigin, callbacks->connection());
253 256
254 EXPECT_TRUE(factory->IsBackingStoreOpenForTesting(kTestOrigin)); 257 EXPECT_TRUE(factory->IsBackingStoreOpenForTesting(kTestOrigin));
255 258
256 // Simulate the write failure. 259 // Simulate the write failure.
257 callbacks->connection()->database()->TransactionCommitFailed(); 260 callbacks->connection()->database()->TransactionCommitFailed();
258 261
259 EXPECT_TRUE(db_callbacks->forced_close_called()); 262 EXPECT_TRUE(db_callbacks->forced_close_called());
260 EXPECT_FALSE(factory->IsBackingStoreOpenForTesting(kTestOrigin)); 263 EXPECT_FALSE(factory->IsBackingStoreOpenForTesting(kTestOrigin));
261 } 264 }
262 265
263 } // namespace content 266 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698