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

Unified Diff: content/browser/appcache/chrome_appcache_service_unittest.cc

Issue 8820009: Appcache, local storage, indexed db, databases: skip exit-time deletion when restarting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 9 years 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
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | content/browser/in_process_webkit/dom_storage_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/chrome_appcache_service_unittest.cc
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc
index 727f5e12d0d5f7f249946219e416d9c0a6887c02..45c51e9c0108c7fb3df7a9c7fceebf715833b150 100644
--- a/content/browser/appcache/chrome_appcache_service_unittest.cc
+++ b/content/browser/appcache/chrome_appcache_service_unittest.cc
@@ -189,4 +189,44 @@ TEST_F(ChromeAppCacheServiceTest, RemoveOnDestruction) {
message_loop_.RunAllPending();
}
+TEST_F(ChromeAppCacheServiceTest, SaveSessionState) {
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+ FilePath appcache_path = temp_dir_.path().Append(kTestingAppCacheDirname);
+
+ // Create a ChromeAppCacheService and insert data into it
+ scoped_refptr<ChromeAppCacheService> appcache_service =
+ CreateAppCacheService(appcache_path, true);
+ ASSERT_TRUE(file_util::PathExists(appcache_path));
+ ASSERT_TRUE(file_util::PathExists(appcache_path.AppendASCII("Index")));
+ InsertDataIntoAppCache(appcache_service);
+
+ appcache_service->set_clear_local_state_on_exit(true);
+ // Save session state. This should bypass the destruction-time deletion.
+ appcache_service->set_save_session_state(true);
+
+ // Test: delete the ChromeAppCacheService
+ appcache_service = NULL;
+ message_loop_.RunAllPending();
+
+ // Recreate the appcache (for reading the data back)
+ appcache_service = CreateAppCacheService(appcache_path, false);
+
+ // The directory is still there
+ ASSERT_TRUE(file_util::PathExists(appcache_path));
+
+ // No appcache data was deleted.
+ AppCacheTestHelper appcache_helper;
+ std::set<GURL> origins;
+ appcache_helper.GetOriginsWithCaches(appcache_service, &origins);
+ EXPECT_EQ(3UL, origins.size());
+ EXPECT_TRUE(origins.find(kProtectedManifestURL.GetOrigin()) != origins.end());
+ EXPECT_TRUE(origins.find(kNormalManifestURL.GetOrigin()) != origins.end());
+ EXPECT_TRUE(origins.find(kSessionOnlyManifestURL.GetOrigin()) !=
+ origins.end());
+
+ // Delete and let cleanup tasks run prior to returning.
+ appcache_service = NULL;
+ message_loop_.RunAllPending();
+}
+
} // namespace appcache
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | content/browser/in_process_webkit/dom_storage_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698