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

Unified Diff: chrome/browser/in_process_webkit/indexed_db_browsertest.cc

Issue 5359005: Moved deleting the indexed db context to the WebKitContext destructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fixes and cleanup. Created 10 years, 1 month 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: chrome/browser/in_process_webkit/indexed_db_browsertest.cc
diff --git a/chrome/browser/in_process_webkit/indexed_db_browsertest.cc b/chrome/browser/in_process_webkit/indexed_db_browsertest.cc
index 4eeac7400cfc06c197723ed9b6f0af0e0ea012f4..abfc953d55904fe487c2480561bcc8def3e09ffb 100644
--- a/chrome/browser/in_process_webkit/indexed_db_browsertest.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_browsertest.cc
@@ -9,10 +9,15 @@
#include "base/scoped_temp_dir.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/in_process_webkit/indexed_db_context.h"
+#include "chrome/browser/in_process_webkit/webkit_context.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/in_process_browser_test.h"
+#include "chrome/test/testing_profile.h"
+#include "chrome/test/thread_test_helper.h"
#include "chrome/test/ui_test_utils.h"
// This browser test is aimed towards exercising the IndexedDB bindings and
@@ -92,9 +97,9 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ClearLocalState) {
IndexedDBContext::kIndexedDBDirectory);
ASSERT_TRUE(file_util::CreateDirectory(indexeddb_dir));
- FilePath::StringType file_name_1(FILE_PATH_LITERAL("http_www.google.com_0"));
+ FilePath::StringType file_name_1(FILE_PATH_LITERAL("http_foo_0"));
file_name_1.append(IndexedDBContext::kIndexedDBExtension);
- FilePath::StringType file_name_2(FILE_PATH_LITERAL("https_www.google.com_0"));
+ FilePath::StringType file_name_2(FILE_PATH_LITERAL("chrome-extension_foo_0"));
file_name_2.append(IndexedDBContext::kIndexedDBExtension);
FilePath temp_file_path_1 = indexeddb_dir.Append(file_name_1);
FilePath temp_file_path_2 = indexeddb_dir.Append(file_name_2);
@@ -102,7 +107,17 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ClearLocalState) {
ASSERT_EQ(1, file_util::WriteFile(temp_file_path_1, ".", 1));
ASSERT_EQ(1, file_util::WriteFile(temp_file_path_2, "o", 1));
- IndexedDBContext::ClearLocalState(temp_dir.path(), "https");
+ // create the scope which will ensure we run the destructor of the webkit
+ // context which should trigger the clean up.
+ TestingProfile profile;
+ profile.GetPrefs()->SetBoolean(prefs::kClearSiteDataOnExit, true);
+ scoped_refptr<WebKitContext> webkit_context(new WebKitContext(&profile));
+ webkit_context->indexed_db_context()->set_data_path(indexeddb_dir);
+ webkit_context->Release();
jochen (gone - plz use gerrit) 2010/11/29 13:29:33 release
pastarmovj 2010/11/29 13:45:12 Done.
+ // Make sure we wait until the destructor has run.
+ scoped_refptr<ThreadTestHelper> helper(
+ new ThreadTestHelper(BrowserThread::WEBKIT));
+ ASSERT_TRUE(helper->Run());
// Because we specified https for scheme to be skipped the second file
// should survive and the first go into vanity.

Powered by Google App Engine
This is Rietveld 408576698