OLD | NEW |
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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 const bool expect_connection = false; | 350 const bool expect_connection = false; |
351 scoped_refptr<MockIndexedDBCallbacks> callbacks( | 351 scoped_refptr<MockIndexedDBCallbacks> callbacks( |
352 new MockIndexedDBCallbacks(expect_connection)); | 352 new MockIndexedDBCallbacks(expect_connection)); |
353 factory()->DeleteDatabase(ASCIIToUTF16("db"), | 353 factory()->DeleteDatabase(ASCIIToUTF16("db"), |
354 NULL /* request_context */, | 354 NULL /* request_context */, |
355 callbacks, | 355 callbacks, |
356 origin, | 356 origin, |
357 temp_directory.path()); | 357 temp_directory.path()); |
358 | 358 |
359 EXPECT_TRUE(factory()->IsBackingStoreOpen(origin)); | |
360 EXPECT_TRUE(factory()->IsBackingStorePendingClose(origin)); | |
361 | |
362 // Now simulate shutdown, which should stop the timer. | 359 // Now simulate shutdown, which should stop the timer. |
363 factory()->ContextDestroyed(); | 360 if(factory()->IsBackingStoreOpen(origin) |
| 361 && factory()->IsBackingStorePendingClose(origin)) |
| 362 factory()->ContextDestroyed(); |
364 | 363 |
365 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin)); | 364 EXPECT_FALSE(factory()->IsBackingStoreOpen(origin)); |
366 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); | 365 EXPECT_FALSE(factory()->IsBackingStorePendingClose(origin)); |
367 } | 366 } |
368 | 367 |
369 TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) { | 368 TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) { |
370 GURL origin("http://localhost:81"); | 369 GURL origin("http://localhost:81"); |
371 | 370 |
372 base::ScopedTempDir temp_directory; | 371 base::ScopedTempDir temp_directory; |
373 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 372 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 temp_directory.path()); | 522 temp_directory.path()); |
524 EXPECT_TRUE(callbacks->saw_error()); | 523 EXPECT_TRUE(callbacks->saw_error()); |
525 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); | 524 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); |
526 } | 525 } |
527 | 526 |
528 // Terminate all pending-close timers. | 527 // Terminate all pending-close timers. |
529 factory()->ForceClose(origin); | 528 factory()->ForceClose(origin); |
530 } | 529 } |
531 | 530 |
532 } // namespace content | 531 } // namespace content |
OLD | NEW |