diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 18:45:45 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 18:45:45 +0000 |
commit | 44d6da87c14860edf8350b4af5d66a3cf59dfda5 (patch) | |
tree | dff42211837600c4eb0af2eeecce02f278b4909a /chrome/browser/extensions/extensions_service_unittest.cc | |
parent | 84e8bdeaaf5c35c0e55dd9eca21422e7bfdc588f (diff) | |
download | chromium_src-44d6da87c14860edf8350b4af5d66a3cf59dfda5.zip chromium_src-44d6da87c14860edf8350b4af5d66a3cf59dfda5.tar.gz chromium_src-44d6da87c14860edf8350b4af5d66a3cf59dfda5.tar.bz2 |
Revert r42467: "Clear cookies, local storage and databases when an extension gets uninstalled."
It introduced a memory leak, causing a regression on valgrind test: unit.
TBR=jochen
Review URL: http://codereview.chromium.org/1295001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service_unittest.cc')
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 7041f9a..a142ca4 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -39,8 +39,6 @@ #include "testing/platform_test.h" #include "webkit/database/database_tracker.h" #include "webkit/database/database_util.h" -#include "net/base/cookie_monster.h" -#include "net/base/cookie_options.h" namespace keys = extension_manifest_keys; @@ -223,7 +221,6 @@ class ExtensionTestingProfile : public TestingProfile { ExtensionsServiceTestBase::ExtensionsServiceTestBase() : loop_(MessageLoop::TYPE_IO), ui_thread_(ChromeThread::UI, &loop_), - webkit_thread_(ChromeThread::WEBKIT, &loop_), file_thread_(ChromeThread::FILE, &loop_) { } @@ -1263,72 +1260,6 @@ TEST_F(ExtensionsServiceTest, UninstallExtension) { EXPECT_FALSE(file_util::PathExists(extension_path)); } -// Verifies extension state is removed upon uninstall -TEST_F(ExtensionsServiceTest, ClearExtensionData) { - InitializeEmptyExtensionsService(); - - // Load a test extension. - FilePath path; - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); - path = path.AppendASCII("extensions"); - path = path.AppendASCII("good.crx"); - InstallExtension(path, true); - Extension* extension = service_->GetExtensionById(good_crx, false); - ASSERT_TRUE(extension); - GURL ext_url(extension->url()); - string16 origin_id = - webkit_database::DatabaseUtil::GetOriginIdentifier(ext_url); - - // Set a cookie for the extension. - net::CookieMonster* cookie_monster = profile_ - ->GetRequestContextForExtensions()->GetCookieStore()->GetCookieMonster(); - ASSERT_TRUE(cookie_monster); - net::CookieOptions options; - cookie_monster->SetCookieWithOptions(ext_url, "dummy=value", options); - net::CookieMonster::CookieList list = - cookie_monster->GetAllCookiesForURL(ext_url); - EXPECT_EQ(1U, list.size()); - - // Open a database. - webkit_database::DatabaseTracker* db_tracker = profile_->GetDatabaseTracker(); - string16 db_name = UTF8ToUTF16("db"); - string16 description = UTF8ToUTF16("db_description"); - int64 size; - int64 available; - db_tracker->DatabaseOpened(origin_id, db_name, description, 1, &size, - &available); - db_tracker->DatabaseClosed(origin_id, db_name); - std::vector<webkit_database::OriginInfo> origins; - db_tracker->GetAllOriginsInfo(&origins); - EXPECT_EQ(1U, origins.size()); - EXPECT_EQ(origin_id, origins[0].GetOrigin()); - - // Create local storage. We only simulate this by creating the backing file - // since webkit is not initialized. - DOMStorageContext* context = - profile_->GetWebKitContext()->dom_storage_context(); - FilePath lso_path = context->GetLocalStorageFilePath(origin_id); - EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName())); - EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0)); - EXPECT_TRUE(file_util::PathExists(lso_path)); - - // Uninstall the extension. - service_->UninstallExtension(good_crx, false); - loop_.RunAllPending(); - - // Check that the cookie is gone. - list = cookie_monster->GetAllCookiesForURL(ext_url); - EXPECT_EQ(0U, list.size()); - - // The database should have vanished as well. - origins.clear(); - db_tracker->GetAllOriginsInfo(&origins); - EXPECT_EQ(0U, origins.size()); - - // Check that the LSO file has been removed. - EXPECT_FALSE(file_util::PathExists(lso_path)); -} - // Tests loading single extensions (like --load-extension) TEST_F(ExtensionsServiceTest, LoadExtension) { InitializeEmptyExtensionsService(); |