Index: content/browser/dom_storage/dom_storage_context_impl_unittest.cc |
diff --git a/content/browser/dom_storage/dom_storage_context_impl_unittest.cc b/content/browser/dom_storage/dom_storage_context_impl_unittest.cc |
index 9ea46028b6f5b90a930775fd9f71fb0e0c79e84b..1d5de9765cb36d3e63c88b7725a90b1f3f487dbe 100644 |
--- a/content/browser/dom_storage/dom_storage_context_impl_unittest.cc |
+++ b/content/browser/dom_storage/dom_storage_context_impl_unittest.cc |
@@ -102,9 +102,11 @@ TEST_F(DOMStorageContextImplTest, UsageInfo) { |
// Put some data into local storage and shutdown the context |
// to ensure data is written to disk. |
+ auto* area = context_->GetStorageNamespace(kLocalStorageNamespaceId)-> |
+ OpenStorageArea(kOrigin); |
base::NullableString16 old_value; |
- EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> |
- OpenStorageArea(kOrigin)->SetItem(kKey, kValue, &old_value)); |
+ EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value)); |
+ area->ScheduleImmediateCommit(); |
context_->Shutdown(); |
context_ = NULL; |
base::MessageLoop::current()->RunUntilIdle(); |
@@ -133,11 +135,14 @@ TEST_F(DOMStorageContextImplTest, SessionOnly) { |
// Store data for a normal and a session-only origin and then |
// invoke Shutdown() which should delete data for session-only |
// origins. |
+ auto* dom_namespace = context_->GetStorageNamespace(kLocalStorageNamespaceId); |
base::NullableString16 old_value; |
- EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> |
- OpenStorageArea(kOrigin)->SetItem(kKey, kValue, &old_value)); |
- EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> |
- OpenStorageArea(kSessionOnlyOrigin)->SetItem(kKey, kValue, &old_value)); |
+ auto* area = dom_namespace->OpenStorageArea(kOrigin); |
+ EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value)); |
+ area->ScheduleImmediateCommit(); |
+ auto* session_only_area = dom_namespace->OpenStorageArea(kSessionOnlyOrigin); |
+ EXPECT_TRUE(session_only_area->SetItem(kKey, kValue, &old_value)); |
+ session_only_area->ScheduleImmediateCommit(); |
context_->Shutdown(); |
context_ = NULL; |
base::MessageLoop::current()->RunUntilIdle(); |
@@ -152,9 +157,11 @@ TEST_F(DOMStorageContextImplTest, SetForceKeepSessionState) { |
// Store data for a session-only origin, setup to save session data, then |
// shutdown. |
+ auto* area = context_->GetStorageNamespace(kLocalStorageNamespaceId)-> |
+ OpenStorageArea(kSessionOnlyOrigin); |
base::NullableString16 old_value; |
- EXPECT_TRUE(context_->GetStorageNamespace(kLocalStorageNamespaceId)-> |
- OpenStorageArea(kSessionOnlyOrigin)->SetItem(kKey, kValue, &old_value)); |
+ EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value)); |
+ area->ScheduleImmediateCommit(); |
context_->SetForceKeepSessionState(); // Should override clear behavior. |
context_->Shutdown(); |
context_ = NULL; |
@@ -213,6 +220,7 @@ TEST_F(DOMStorageContextImplTest, DeleteSessionStorage) { |
const base::string16 kValue(ASCIIToUTF16("bar")); |
base::NullableString16 old_nullable_value; |
area->SetItem(kKey, kValue, &old_nullable_value); |
+ area->ScheduleImmediateCommit(); |
dom_namespace->CloseStorageArea(area); |
// Destroy and recreate the DOMStorageContextImpl. |
@@ -238,6 +246,7 @@ TEST_F(DOMStorageContextImplTest, DeleteSessionStorage) { |
info.origin = kOrigin; |
info.persistent_namespace_id = kPersistentId; |
context_->DeleteSessionStorage(info); |
+ area->ScheduleImmediateCommit(); |
// Destroy and recreate again. |
context_->Shutdown(); |