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

Unified Diff: content/browser/dom_storage/dom_storage_area_unittest.cc

Issue 1102263003: Discard uncommitted changes when shutting down DOMStorageArea Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/dom_storage/dom_storage_area_unittest.cc
diff --git a/content/browser/dom_storage/dom_storage_area_unittest.cc b/content/browser/dom_storage/dom_storage_area_unittest.cc
index aa5653da319a55db2730d0a8c3d5bee8b0727886..578d650bac5212109685f2de7e605b50b73cab0b 100644
--- a/content/browser/dom_storage/dom_storage_area_unittest.cc
+++ b/content/browser/dom_storage/dom_storage_area_unittest.cc
@@ -68,20 +68,6 @@ class DOMStorageAreaTest : public testing::Test {
EXPECT_TRUE(area->HasUncommittedChanges());
}
- // Class used in the CommitChangesAtShutdown test case.
- class VerifyChangesCommittedDatabase : public DOMStorageDatabase {
- public:
- VerifyChangesCommittedDatabase() {}
- ~VerifyChangesCommittedDatabase() override {
- const base::string16 kKey(ASCIIToUTF16("key"));
- const base::string16 kValue(ASCIIToUTF16("value"));
- DOMStorageValuesMap values;
- ReadAllValues(&values);
- EXPECT_EQ(1u, values.size());
- EXPECT_EQ(kValue, values[kKey].string());
- }
- };
-
private:
base::MessageLoop message_loop_;
};
@@ -296,33 +282,6 @@ TEST_F(DOMStorageAreaTest, CommitTasks) {
EXPECT_EQ(kValue2, values[kKey2].string());
}
-TEST_F(DOMStorageAreaTest, CommitChangesAtShutdown) {
- base::ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
- scoped_refptr<DOMStorageArea> area(new DOMStorageArea(
- kOrigin,
- temp_dir.path(),
- new MockDOMStorageTaskRunner(base::MessageLoopProxy::current().get())));
-
- // Inject an in-memory db to speed up the test and also to verify
- // the final changes are commited in it's dtor.
- static_cast<LocalStorageDatabaseAdapter*>(area->backing_.get())->db_.reset(
- new VerifyChangesCommittedDatabase());
-
- DOMStorageValuesMap values;
- base::NullableString16 old_value;
- EXPECT_TRUE(area->SetItem(kKey, kValue, &old_value));
- EXPECT_TRUE(area->HasUncommittedChanges());
- area->backing_->ReadAllValues(&values);
- EXPECT_TRUE(values.empty()); // not committed yet
- area->Shutdown();
- base::MessageLoop::current()->RunUntilIdle();
- EXPECT_TRUE(area->HasOneRef());
- EXPECT_FALSE(area->backing_.get());
- // The VerifyChangesCommittedDatabase destructor verifies values
- // were committed.
-}
-
TEST_F(DOMStorageAreaTest, DeleteOrigin) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.cc ('k') | content/browser/dom_storage/dom_storage_context_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698