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

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

Issue 9836066: Have content cancel requests for ResourceContexts when they shutdown, instead of depending on the e… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/in_process_webkit/indexed_db_browsertest.cc
===================================================================
--- content/browser/in_process_webkit/indexed_db_browsertest.cc (revision 128565)
+++ content/browser/in_process_webkit/indexed_db_browsertest.cc (working copy)
@@ -135,179 +135,6 @@
ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1);
}
-#if defined(OS_MACOSX)
-// http://crbug.com/115188. On Mac, failure rate is about 18% currently.
-#define MAYBE_ClearLocalState DISABLED_ClearLocalState
-#else
-#define MAYBE_ClearLocalState ClearLocalState
-#endif
-
-// In proc browser test is needed here because ClearLocalState indirectly calls
-// WebKit's isMainThread through WebSecurityOrigin->SecurityOrigin.
-IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, MAYBE_ClearLocalState) {
- ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-
- FilePath protected_path;
- FilePath unprotected_path;
-
- // Create the scope which will ensure we run the destructor of the webkit
- // context which should trigger the clean up.
- {
- TestingProfile profile;
-
- // Test our assumptions about what is protected and what is not.
- const GURL kProtectedOrigin("chrome-extension://foo/");
- const GURL kUnprotectedOrigin("http://foo/");
- quota::SpecialStoragePolicy* policy = profile.GetSpecialStoragePolicy();
- ASSERT_TRUE(policy->IsStorageProtected(kProtectedOrigin));
- ASSERT_FALSE(policy->IsStorageProtected(kUnprotectedOrigin));
-
- // Create some indexedDB paths.
- // With the levelDB backend, these are directories.
- IndexedDBContextImpl* idb_context =
- static_cast<IndexedDBContextImpl*>(
- BrowserContext::GetIndexedDBContext(&profile));
- idb_context->set_data_path_for_testing(temp_dir.path());
- protected_path = idb_context->GetFilePathForTesting(
- DatabaseUtil::GetOriginIdentifier(kProtectedOrigin));
- unprotected_path = idb_context->GetFilePathForTesting(
- DatabaseUtil::GetOriginIdentifier(kUnprotectedOrigin));
- ASSERT_TRUE(file_util::CreateDirectory(protected_path));
- ASSERT_TRUE(file_util::CreateDirectory(unprotected_path));
-
- // Setup to clear all unprotected origins on exit.
- idb_context->set_clear_local_state_on_exit(true);
- }
-
- // Make sure we wait until the destructor has run.
- scoped_refptr<base::ThreadTestHelper> helper_io(
- new base::ThreadTestHelper(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
- ASSERT_TRUE(helper_io->Run());
- scoped_refptr<base::ThreadTestHelper> helper_webkit(
- new base::ThreadTestHelper(
- BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::WEBKIT_DEPRECATED)));
- ASSERT_TRUE(helper_webkit->Run());
-
- ASSERT_TRUE(file_util::DirectoryExists(protected_path));
- ASSERT_FALSE(file_util::DirectoryExists(unprotected_path));
-}
-
-// In proc browser test is needed here because ClearLocalState indirectly calls
-// WebKit's isMainThread through WebSecurityOrigin->SecurityOrigin.
-// http://crbug.com/115307
-IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest,
- DISABLED_ClearSessionOnlyDatabases) {
- ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-
- FilePath normal_path;
- FilePath session_only_path;
-
- // Create the scope which will ensure we run the destructor of the webkit
- // context which should trigger the clean up.
- {
- TestingProfile profile;
-
- const GURL kNormalOrigin("http://normal/");
- const GURL kSessionOnlyOrigin("http://session-only/");
- scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
- new quota::MockSpecialStoragePolicy;
- special_storage_policy->AddSessionOnly(kSessionOnlyOrigin);
-
- // Create some indexedDB paths.
- // With the levelDB backend, these are directories.
- IndexedDBContextImpl* idb_context =
- static_cast<IndexedDBContextImpl*>(
- BrowserContext::GetIndexedDBContext(&profile));
-
- // Override the storage policy with our own.
- idb_context->special_storage_policy_ = special_storage_policy;
- idb_context->set_data_path_for_testing(temp_dir.path());
-
- normal_path = idb_context->GetFilePathForTesting(
- DatabaseUtil::GetOriginIdentifier(kNormalOrigin));
- session_only_path = idb_context->GetFilePathForTesting(
- DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin));
- ASSERT_TRUE(file_util::CreateDirectory(normal_path));
- ASSERT_TRUE(file_util::CreateDirectory(session_only_path));
- }
-
- scoped_refptr<base::ThreadTestHelper> helper_io(
- new base::ThreadTestHelper(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
- ASSERT_TRUE(helper_io->Run());
- scoped_refptr<base::ThreadTestHelper> helper_webkit(
- new base::ThreadTestHelper(
- BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::WEBKIT_DEPRECATED)));
- ASSERT_TRUE(helper_webkit->Run());
-
- EXPECT_TRUE(file_util::DirectoryExists(normal_path));
- EXPECT_FALSE(file_util::DirectoryExists(session_only_path));
-}
-
-#if defined(OS_MACOSX)
-// http://crbug.com/115188. On Mac, failure rate is about 18% currently.
-#define MAYBE_SaveSessionState DISABLED_SaveSessionState
-#else
-#define MAYBE_SaveSessionState SaveSessionState
-#endif
-
-IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, MAYBE_SaveSessionState) {
- ScopedTempDir temp_dir;
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-
- FilePath normal_path;
- FilePath session_only_path;
-
- // Create the scope which will ensure we run the destructor of the webkit
- // context.
- {
- TestingProfile profile;
-
- const GURL kNormalOrigin("http://normal/");
- const GURL kSessionOnlyOrigin("http://session-only/");
- scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
- new quota::MockSpecialStoragePolicy;
- special_storage_policy->AddSessionOnly(kSessionOnlyOrigin);
-
- // Create some indexedDB paths.
- // With the levelDB backend, these are directories.
- IndexedDBContextImpl* idb_context =
- static_cast<IndexedDBContextImpl*>(
- BrowserContext::GetIndexedDBContext(&profile));
-
- // Override the storage policy with our own.
- idb_context->special_storage_policy_ = special_storage_policy;
- idb_context->set_clear_local_state_on_exit(true);
- idb_context->set_data_path_for_testing(temp_dir.path());
-
- // Save session state. This should bypass the destruction-time deletion.
- idb_context->SaveSessionState();
-
- normal_path = idb_context->GetFilePathForTesting(
- DatabaseUtil::GetOriginIdentifier(kNormalOrigin));
- session_only_path = idb_context->GetFilePathForTesting(
- DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin));
- ASSERT_TRUE(file_util::CreateDirectory(normal_path));
- ASSERT_TRUE(file_util::CreateDirectory(session_only_path));
- }
-
- // Make sure we wait until the destructor has run.
- scoped_refptr<base::ThreadTestHelper> helper(
- new base::ThreadTestHelper(
- BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::WEBKIT_DEPRECATED)));
- ASSERT_TRUE(helper->Run());
-
- // No data was cleared because of SaveSessionState.
- EXPECT_TRUE(file_util::DirectoryExists(normal_path));
- EXPECT_TRUE(file_util::DirectoryExists(session_only_path));
-}
-
class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest {
public:
virtual void SetUpOnMainThread() {
« no previous file with comments | « content/browser/in_process_webkit/dom_storage_unittest.cc ('k') | content/browser/in_process_webkit/indexed_db_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698