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

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

Issue 2642943002: Allow closing IndexedDB database before deleting (Closed)
Patch Set: Allow closing IndexedDB database before deleting Created 3 years, 11 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 base::ScopedTempDir temp_directory; 338 base::ScopedTempDir temp_directory;
339 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); 339 ASSERT_TRUE(temp_directory.CreateUniqueTempDir());
340 340
341 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin)); 341 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin));
342 342
343 const bool expect_connection = false; 343 const bool expect_connection = false;
344 scoped_refptr<MockIndexedDBCallbacks> callbacks( 344 scoped_refptr<MockIndexedDBCallbacks> callbacks(
345 new MockIndexedDBCallbacks(expect_connection)); 345 new MockIndexedDBCallbacks(expect_connection));
346 factory()->DeleteDatabase(ASCIIToUTF16("db"), nullptr /* request_context */, 346 factory()->DeleteDatabase(ASCIIToUTF16("db"), nullptr /* request_context */,
347 callbacks, origin, temp_directory.GetPath()); 347 callbacks, origin, temp_directory.GetPath(),
348 false /* force_close */);
348 349
349 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin)); 350 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
350 EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin)); 351 EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin));
351 352
352 // Now simulate shutdown, which should stop the timer. 353 // Now simulate shutdown, which should stop the timer.
353 factory()->ContextDestroyed(); 354 factory()->ContextDestroyed();
354 355
355 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin)); 356 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin));
356 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); 357 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin));
357 } 358 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 temp_directory.GetPath()); 505 temp_directory.GetPath());
505 EXPECT_TRUE(callbacks->saw_error()); 506 EXPECT_TRUE(callbacks->saw_error());
506 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); 507 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));
507 } 508 }
508 509
509 // Terminate all pending-close timers. 510 // Terminate all pending-close timers.
510 factory()->ForceClose(origin); 511 factory()->ForceClose(origin);
511 } 512 }
512 513
513 } // namespace content 514 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698