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

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

Issue 1706413002: Indexed DB: Rename "int version" to "version" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 10 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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 GURL origin("http://localhost:81"); 276 GURL origin("http://localhost:81");
277 277
278 base::ScopedTempDir temp_directory; 278 base::ScopedTempDir temp_directory;
279 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 279 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
280 280
281 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks()); 281 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks());
282 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks( 282 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks(
283 new MockIndexedDBDatabaseCallbacks()); 283 new MockIndexedDBDatabaseCallbacks());
284 const int64_t transaction_id = 1; 284 const int64_t transaction_id = 1;
285 IndexedDBPendingConnection connection( 285 IndexedDBPendingConnection connection(
286 callbacks, 286 callbacks, db_callbacks, 0, /* child_process_id */
287 db_callbacks, 287 transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION);
288 0, /* child_process_id */
289 transaction_id,
290 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
291 factory()->Open(ASCIIToUTF16("db"), 288 factory()->Open(ASCIIToUTF16("db"),
292 connection, 289 connection,
293 NULL /* request_context */, 290 NULL /* request_context */,
294 origin, 291 origin,
295 temp_directory.path()); 292 temp_directory.path());
296 293
297 EXPECT_TRUE(callbacks->connection()); 294 EXPECT_TRUE(callbacks->connection());
298 295
299 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin)); 296 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
300 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); 297 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin));
301 298
302 callbacks->connection()->ForceClose(); 299 callbacks->connection()->ForceClose();
303 300
304 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin)); 301 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin));
305 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); 302 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin));
306 } 303 }
307 304
308 TEST_F(IndexedDBFactoryTest, BackingStoreReleaseDelayedOnClose) { 305 TEST_F(IndexedDBFactoryTest, BackingStoreReleaseDelayedOnClose) {
309 GURL origin("http://localhost:81"); 306 GURL origin("http://localhost:81");
310 307
311 base::ScopedTempDir temp_directory; 308 base::ScopedTempDir temp_directory;
312 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 309 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
313 310
314 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks()); 311 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks());
315 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks( 312 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks(
316 new MockIndexedDBDatabaseCallbacks()); 313 new MockIndexedDBDatabaseCallbacks());
317 const int64_t transaction_id = 1; 314 const int64_t transaction_id = 1;
318 IndexedDBPendingConnection connection( 315 IndexedDBPendingConnection connection(
319 callbacks, 316 callbacks, db_callbacks, 0, /* child_process_id */
320 db_callbacks, 317 transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION);
321 0, /* child_process_id */
322 transaction_id,
323 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
324 factory()->Open(ASCIIToUTF16("db"), 318 factory()->Open(ASCIIToUTF16("db"),
325 connection, 319 connection,
326 NULL /* request_context */, 320 NULL /* request_context */,
327 origin, 321 origin,
328 temp_directory.path()); 322 temp_directory.path());
329 323
330 EXPECT_TRUE(callbacks->connection()); 324 EXPECT_TRUE(callbacks->connection());
331 IndexedDBBackingStore* store = 325 IndexedDBBackingStore* store =
332 callbacks->connection()->database()->backing_store(); 326 callbacks->connection()->database()->backing_store();
333 EXPECT_FALSE(store->HasOneRef()); // Factory and database. 327 EXPECT_FALSE(store->HasOneRef()); // Factory and database.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 GURL origin("http://localhost:81"); 398 GURL origin("http://localhost:81");
405 399
406 base::ScopedTempDir temp_directory; 400 base::ScopedTempDir temp_directory;
407 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 401 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
408 402
409 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks()); 403 scoped_refptr<MockIndexedDBCallbacks> callbacks(new MockIndexedDBCallbacks());
410 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks( 404 scoped_refptr<MockIndexedDBDatabaseCallbacks> db_callbacks(
411 new MockIndexedDBDatabaseCallbacks()); 405 new MockIndexedDBDatabaseCallbacks());
412 const int64_t transaction_id = 1; 406 const int64_t transaction_id = 1;
413 IndexedDBPendingConnection connection( 407 IndexedDBPendingConnection connection(
414 callbacks, 408 callbacks, db_callbacks, 0, /* child_process_id */
415 db_callbacks, 409 transaction_id, IndexedDBDatabaseMetadata::DEFAULT_VERSION);
416 0, /* child_process_id */
417 transaction_id,
418 IndexedDBDatabaseMetadata::DEFAULT_INT_VERSION);
419 factory()->Open(ASCIIToUTF16("db"), 410 factory()->Open(ASCIIToUTF16("db"),
420 connection, 411 connection,
421 NULL /* request_context */, 412 NULL /* request_context */,
422 origin, 413 origin,
423 temp_directory.path()); 414 temp_directory.path());
424 415
425 EXPECT_TRUE(callbacks->connection()); 416 EXPECT_TRUE(callbacks->connection());
426 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin)); 417 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
427 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); 418 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin));
428 419
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 temp_directory.path()); 524 temp_directory.path());
534 EXPECT_TRUE(callbacks->saw_error()); 525 EXPECT_TRUE(callbacks->saw_error());
535 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); 526 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));
536 } 527 }
537 528
538 // Terminate all pending-close timers. 529 // Terminate all pending-close timers.
539 factory()->ForceClose(origin); 530 factory()->ForceClose(origin);
540 } 531 }
541 532
542 } // namespace content 533 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.cc ('k') | content/browser/indexed_db/indexed_db_fake_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698