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

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

Issue 2642943002: Allow closing IndexedDB database before deleting (Closed)
Patch Set: Fixed compilation errors in tests 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(), false);
cmumford 2017/01/19 20:47:16 Add /* force_close */ to parameter.
eostroukhov 2017/01/20 18:43:18 Done.
348 348
349 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin)); 349 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin));
350 EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin)); 350 EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin));
351 351
352 // Now simulate shutdown, which should stop the timer. 352 // Now simulate shutdown, which should stop the timer.
353 factory()->ContextDestroyed(); 353 factory()->ContextDestroyed();
354 354
355 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin)); 355 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin));
356 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); 356 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin));
357 } 357 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 temp_directory.GetPath()); 504 temp_directory.GetPath());
505 EXPECT_TRUE(callbacks->saw_error()); 505 EXPECT_TRUE(callbacks->saw_error());
506 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); 506 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name));
507 } 507 }
508 508
509 // Terminate all pending-close timers. 509 // Terminate all pending-close timers.
510 factory()->ForceClose(origin); 510 factory()->ForceClose(origin);
511 } 511 }
512 512
513 } // namespace content 513 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698