| Index: chrome/browser/extensions/extension_service_unittest.cc
|
| diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
|
| index 18a5652aaf3425d3b482dba86244f6a108513cea..49ca4589af5dc9a94afa9cad723aaf6d34fec19b 100644
|
| --- a/chrome/browser/extensions/extension_service_unittest.cc
|
| +++ b/chrome/browser/extensions/extension_service_unittest.cc
|
| @@ -22,6 +22,7 @@
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/path_service.h"
|
| +#include "base/run_loop.h"
|
| #include "base/stl_util.h"
|
| #include "base/strings/string16.h"
|
| #include "base/strings/string_number_conversions.h"
|
| @@ -82,6 +83,7 @@
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "components/user_prefs/pref_registry_syncable.h"
|
| +#include "content/public/browser/cookie_store_map.h"
|
| #include "content/public/browser/dom_storage_context.h"
|
| #include "content/public/browser/gpu_data_manager.h"
|
| #include "content/public/browser/indexed_db_context.h"
|
| @@ -91,7 +93,6 @@
|
| #include "content/public/browser/render_process_host.h"
|
| #include "content/public/browser/storage_partition.h"
|
| #include "content/public/common/content_constants.h"
|
| -#include "content/public/test/test_browser_thread.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "extensions/common/constants.h"
|
| #include "extensions/common/extension_resource.h"
|
| @@ -440,15 +441,10 @@ ExtensionServiceInitParams()
|
|
|
| // Our message loop may be used in tests which require it to be an IO loop.
|
| ExtensionServiceTestBase::ExtensionServiceTestBase()
|
| - : loop_(base::MessageLoop::TYPE_IO),
|
| + : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
|
| service_(NULL),
|
| management_policy_(NULL),
|
| - expected_extensions_count_(0),
|
| - ui_thread_(BrowserThread::UI, &loop_),
|
| - db_thread_(BrowserThread::DB, &loop_),
|
| - file_thread_(BrowserThread::FILE, &loop_),
|
| - file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, &loop_),
|
| - io_thread_(BrowserThread::IO, &loop_) {
|
| + expected_extensions_count_(0) {
|
| base::FilePath test_data_dir;
|
| if (!PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)) {
|
| ADD_FAILURE();
|
| @@ -475,8 +471,9 @@ void ExtensionServiceTestBase::InitializeExtensionService(
|
| // If pref_file is empty, TestingProfile automatically creates
|
| // TestingPrefServiceSyncable instance.
|
| if (!params.pref_file.empty()) {
|
| - builder.WithUserFilePrefs(params.pref_file,
|
| - loop_.message_loop_proxy().get());
|
| + builder.WithUserFilePrefs(
|
| + params.pref_file,
|
| + base::MessageLoop::current()->message_loop_proxy().get());
|
| scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
|
| new user_prefs::PrefRegistrySyncable);
|
| scoped_ptr<PrefServiceSyncable> prefs(
|
| @@ -500,7 +497,8 @@ void ExtensionServiceTestBase::InitializeExtensionService(
|
| CommandLine::ForCurrentProcess(),
|
| params.extensions_install_dir,
|
| params.autoupdate_enabled);
|
| - service_->SetFileTaskRunnerForTesting(loop_.message_loop_proxy().get());
|
| + service_->SetFileTaskRunnerForTesting(
|
| + base::MessageLoop::current()->message_loop_proxy().get());
|
| service_->set_extensions_enabled(true);
|
| service_->set_show_extensions_prompts(false);
|
| service_->set_install_updates_when_idle_for_test(false);
|
| @@ -694,8 +692,8 @@ class ExtensionServiceTest
|
| }
|
|
|
| // Create a CrxInstaller and start installation. To allow the install
|
| - // to happen, use loop_.RunUntilIdle();. Most tests will not use this
|
| - // method directly. Instead, use InstallCrx(), which waits for
|
| + // to happen, use base::RunLoop().RunUntilIdle();. Most tests will not use
|
| + // this method directly. Instead, use InstallCrx(), which waits for
|
| // the crx to be installed and does extra error checking.
|
| void StartCRXInstall(const base::FilePath& crx_path) {
|
| StartCRXInstall(crx_path, Extension::NO_FLAGS);
|
| @@ -913,7 +911,7 @@ class ExtensionServiceTest
|
| chrome::NOTIFICATION_CRX_INSTALLER_DONE,
|
| content::Source<extensions::CrxInstaller>(installer)).Wait();
|
| } else {
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| std::vector<string16> errors = GetErrors();
|
| @@ -996,7 +994,7 @@ class ExtensionServiceTest
|
|
|
| // The extension should not be in the service anymore.
|
| EXPECT_FALSE(service_->GetInstalledExtension(id));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // The directory should be gone.
|
| EXPECT_FALSE(base::PathExists(extension_path));
|
| @@ -1401,7 +1399,7 @@ TEST_F(ExtensionServiceTest, CleanupOnStartup) {
|
| // be called, call it manually instead.
|
| service_->GarbageCollectExtensions();
|
| // Wait for GarbageCollectExtensions task to complete.
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| base::FileEnumerator dirs(extensions_install_dir_, false,
|
| base::FileEnumerator::DIRECTORIES);
|
| @@ -1439,7 +1437,7 @@ TEST_F(ExtensionServiceTest, GarbageCollectWithPendingUpdates) {
|
|
|
| service_->GarbageCollectExtensions();
|
| // Wait for GarbageCollectExtensions task to complete.
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Verify that the pending update for the first extension didn't get
|
| // deleted.
|
| @@ -1477,7 +1475,7 @@ TEST_F(ExtensionServiceTest, UpdateOnStartup) {
|
| // be called, call it manually instead.
|
| service_->GarbageCollectExtensions();
|
| // Wait for GarbageCollectExtensions task to complete.
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Verify that the pending update for the first extension got installed.
|
| EXPECT_FALSE(base::PathExists(extensions_install_dir_.AppendASCII(
|
| @@ -1513,7 +1511,7 @@ TEST_F(ExtensionServiceTest, PendingImports) {
|
|
|
| service_->Init();
|
| // Wait for GarbageCollectExtensions task to complete.
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // These extensions are used by the extensions we test below, they must be
|
| // installed.
|
| @@ -1753,7 +1751,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
|
| service_->OnExternalExtensionFileFound(good_crx, &version,
|
| path, Manifest::EXTERNAL_PREF,
|
| Extension::NO_FLAGS, false);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(NULL == service_->GetExtensionById(good_crx, false));
|
| ValidateIntegerPref(good_crx, "location",
|
| Extension::EXTERNAL_EXTENSION_UNINSTALLED);
|
| @@ -1764,7 +1762,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
|
| service_->OnExternalExtensionFileFound(good_crx, &version,
|
| path, Manifest::EXTERNAL_PREF,
|
| Extension::NO_FLAGS, false);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(NULL == service_->GetExtensionById(good_crx, false));
|
| ValidateIntegerPref(good_crx, "location",
|
| Extension::EXTERNAL_EXTENSION_UNINSTALLED);
|
| @@ -1887,7 +1885,7 @@ TEST_F(ExtensionServiceTest, InstallUserScript) {
|
| path,
|
| GURL("http://www.aaronboodman.com/scripts/user_script_basic.user.js"));
|
|
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| std::vector<string16> errors = GetErrors();
|
| EXPECT_TRUE(installed_) << "Nothing was installed.";
|
| EXPECT_FALSE(was_update_) << path.value();
|
| @@ -1914,7 +1912,7 @@ TEST_F(ExtensionServiceTest, InstallExtensionDuringShutdown) {
|
| scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service_, NULL));
|
| installer->set_allow_silent_install(true);
|
| installer->InstallCrx(path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_FALSE(installed_) << "Extension installed during shutdown.";
|
| ASSERT_EQ(0u, loaded_.size()) << "Extension loaded during shutdown.";
|
| @@ -2407,7 +2405,7 @@ TEST_F(ExtensionServiceTest, LoadLocalizedTheme) {
|
| .AppendASCII("theme_i18n");
|
|
|
| extensions::UnpackedInstaller::Create(service_)->Load(extension_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| EXPECT_EQ(1u, service_->extensions()->size());
|
| @@ -2449,7 +2447,7 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionCanChangeID) {
|
| base::CopyFile(manifest_no_key, manifest_path);
|
| extensions::UnpackedInstaller::Create(service_)->Load(extension_path);
|
|
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| EXPECT_EQ(1u, service_->extensions()->size());
|
| @@ -2493,7 +2491,7 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) {
|
| // Load extension.
|
| InitializeEmptyExtensionService();
|
| extensions::UnpackedInstaller::Create(service_)->Load(extension_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_TRUE(GetErrors().empty());
|
| ASSERT_EQ(1u, loaded_.size());
|
| @@ -2838,7 +2836,7 @@ TEST_F(ExtensionServiceTest, UpdateNotInstalledExtension) {
|
|
|
| base::FilePath path = data_dir_.AppendASCII("good.crx");
|
| UpdateExtension(good_crx, path, UPDATED);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| ASSERT_EQ(0u, service_->extensions()->size());
|
| ASSERT_FALSE(installed_);
|
| @@ -2943,7 +2941,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) {
|
| ASSERT_TRUE(serializer.Serialize(manifest));
|
|
|
| extensions::UnpackedInstaller::Create(service_)->Load(extension_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| @@ -2957,7 +2955,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) {
|
| ASSERT_TRUE(serializer.Serialize(manifest));
|
|
|
| extensions::UnpackedInstaller::Create(service_)->Load(extension_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| @@ -2993,7 +2991,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) {
|
| // The extension that has a plugin should not install.
|
| extensions::UnpackedInstaller::Create(service_)->Load(
|
| extension_with_plugin_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| EXPECT_EQ(0u, loaded_.size());
|
| EXPECT_EQ(0u, service_->extensions()->size());
|
| @@ -3003,7 +3001,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) {
|
| ExtensionErrorReporter::GetInstance()->ClearErrors();
|
| extensions::UnpackedInstaller::Create(service_)->Load(
|
| extension_no_plugin_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| EXPECT_EQ(1u, loaded_.size());
|
| EXPECT_EQ(1u, service_->extensions()->size());
|
| @@ -3018,7 +3016,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) {
|
| ExtensionErrorReporter::GetInstance()->ClearErrors();
|
| extensions::UnpackedInstaller::Create(service_)->Load(
|
| extension_with_plugin_path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| EXPECT_EQ(2u, loaded_.size());
|
| EXPECT_EQ(2u, service_->extensions()->size());
|
| @@ -3041,7 +3039,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) {
|
| "cancel");
|
|
|
| service_->ReloadExtension(good1);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1u, loaded_.size());
|
| EXPECT_EQ(2u, service_->extensions()->size());
|
| EXPECT_EQ(0u, service_->disabled_extensions()->size());
|
| @@ -3284,7 +3282,7 @@ TEST_F(ExtensionServiceTest, SetUnsetBlacklistInPrefs) {
|
| "v1");
|
|
|
| // Make sure pref is updated
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // blacklist is set for good0,1,2
|
| ValidateBooleanPref(good0, "blacklist", true);
|
| @@ -3321,7 +3319,7 @@ TEST_F(ExtensionServiceTest, UnloadBlacklistedExtension) {
|
| "v1");
|
|
|
| // Make sure pref is updated
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Now, the good_crx is blacklisted.
|
| ValidateBooleanPref(good_crx, "blacklist", true);
|
| @@ -3333,7 +3331,7 @@ TEST_F(ExtensionServiceTest, UnloadBlacklistedExtension) {
|
| "v2");
|
|
|
| // Make sure pref is updated
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| // blacklist value should not be set for good_crx
|
| EXPECT_FALSE(IsPrefExist(good_crx, "blacklist"));
|
| }
|
| @@ -3382,7 +3380,7 @@ TEST_F(ExtensionServiceTest, UnloadBlacklistedExtensionPolicy) {
|
| "v1");
|
|
|
| // Make sure pref is updated
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // The good_crx is blacklisted and the whitelist doesn't negate it.
|
| ValidateBooleanPref(good_crx, "blacklist", true);
|
| @@ -3408,7 +3406,7 @@ TEST_F(ExtensionServiceTest, WillNotLoadBlacklistedExtensionsFromDirectory) {
|
| "v1");
|
|
|
| // Make sure pref is updated
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| ValidateBooleanPref(good1, "blacklist", true);
|
|
|
| @@ -3478,7 +3476,7 @@ TEST_F(ExtensionServiceTest, BlacklistedByPolicyRemovedIfRunning) {
|
| }
|
|
|
| // Extension should not be running now.
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, service_->extensions()->size());
|
| }
|
|
|
| @@ -3522,7 +3520,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) {
|
| ListValue* blacklist = update.Get();
|
| blacklist->Append(Value::CreateStringValue(good0));
|
| }
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(1u, service_->extensions()->size());
|
| EXPECT_TRUE(service_->GetExtensionById(good0, false));
|
| }
|
| @@ -3571,7 +3569,7 @@ TEST_F(ExtensionServiceTest, PolicyInstalledExtensionsWhitelisted) {
|
| ListValue* blacklist = update.Get();
|
| blacklist->Append(Value::CreateStringValue(good0));
|
| }
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(1u, service_->extensions()->size());
|
| EXPECT_TRUE(service_->GetExtensionById(good_crx, false));
|
| }
|
| @@ -3914,7 +3912,7 @@ TEST_F(ExtensionServiceTest, ReloadExtension) {
|
| .AppendASCII(extension_id)
|
| .AppendASCII("1.0.0.0");
|
| extensions::UnpackedInstaller::Create(service_)->Load(ext);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_EQ(1u, service_->extensions()->size());
|
| EXPECT_EQ(0u, service_->disabled_extensions()->size());
|
| @@ -3931,7 +3929,7 @@ TEST_F(ExtensionServiceTest, ReloadExtension) {
|
| service_->ReloadExtension(extension_id);
|
|
|
| // Finish reloading
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Extension should be enabled again.
|
| EXPECT_EQ(1u, service_->extensions()->size());
|
| @@ -4069,7 +4067,7 @@ TEST_F(ExtensionServiceTest, UnpackedRequirements) {
|
| base::FilePath path = data_dir_.AppendASCII("requirements")
|
| .AppendASCII("v2_bad_requirements");
|
| extensions::UnpackedInstaller::Create(service_)->Load(path);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1u, GetErrors().size());
|
| EXPECT_EQ(0u, service_->extensions()->size());
|
| }
|
| @@ -4110,23 +4108,25 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
|
| std::string origin_id = webkit_database::GetIdentifierFromOrigin(ext_url);
|
|
|
| // Set a cookie for the extension.
|
| - net::CookieMonster* cookie_monster =
|
| - profile_->GetRequestContextForExtensions()->GetURLRequestContext()->
|
| - cookie_store()->GetCookieMonster();
|
| + net::CookieStore* cookie_store =
|
| + BrowserContext::GetDefaultStoragePartition(profile_.get())->
|
| + GetCookieStoreMap().GetForScheme(ext_url.scheme());
|
| + ASSERT_TRUE(cookie_store);
|
| + net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster();
|
| ASSERT_TRUE(cookie_monster);
|
| net::CookieOptions options;
|
| cookie_monster->SetCookieWithOptionsAsync(
|
| ext_url, "dummy=value", options,
|
| base::Bind(&ExtensionCookieCallback::SetCookieCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(callback.result_);
|
|
|
| cookie_monster->GetAllCookiesForURLAsync(
|
| ext_url,
|
| base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1U, callback.list_.size());
|
|
|
| // Open a database.
|
| @@ -4167,14 +4167,14 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
|
|
|
| // Uninstall the extension.
|
| service_->UninstallExtension(good_crx, false, NULL);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Check that the cookie is gone.
|
| cookie_monster->GetAllCookiesForURLAsync(
|
| ext_url,
|
| base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0U, callback.list_.size());
|
|
|
| // The database should have vanished as well.
|
| @@ -4226,23 +4226,25 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
|
| IsStorageUnlimited(origin2));
|
|
|
| // Set a cookie for the extension.
|
| + content::StoragePartition* partition =
|
| + content::BrowserContext::GetDefaultStoragePartition(profile_.get());
|
| net::CookieMonster* cookie_monster =
|
| - profile_->GetRequestContext()->GetURLRequestContext()->
|
| - cookie_store()->GetCookieMonster();
|
| + partition->GetCookieStoreMap().GetForScheme(origin1.scheme())->
|
| + GetCookieMonster();
|
| ASSERT_TRUE(cookie_monster);
|
| net::CookieOptions options;
|
| cookie_monster->SetCookieWithOptionsAsync(
|
| origin1, "dummy=value", options,
|
| base::Bind(&ExtensionCookieCallback::SetCookieCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(callback.result_);
|
|
|
| cookie_monster->GetAllCookiesForURLAsync(
|
| origin1,
|
| base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1U, callback.list_.size());
|
|
|
| // Open a database.
|
| @@ -4293,7 +4295,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
|
| origin1,
|
| base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1U, callback.list_.size());
|
|
|
| // Now uninstall the other. Storage should be cleared for the apps.
|
| @@ -4307,7 +4309,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
|
| origin1,
|
| base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback,
|
| base::Unretained(&callback)));
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0U, callback.list_.size());
|
|
|
| // The database should have vanished as well.
|
| @@ -4333,7 +4335,7 @@ TEST_F(ExtensionServiceTest, DISABLED_LoadExtension) {
|
| .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj")
|
| .AppendASCII("1.0.0.0");
|
| extensions::UnpackedInstaller::Create(service_)->Load(ext1);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| EXPECT_EQ(Manifest::UNPACKED, loaded_[0]->location());
|
| @@ -4347,7 +4349,7 @@ TEST_F(ExtensionServiceTest, DISABLED_LoadExtension) {
|
| .AppendASCII("cccccccccccccccccccccccccccccccc")
|
| .AppendASCII("1");
|
| extensions::UnpackedInstaller::Create(service_)->Load(no_manifest);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(1u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| EXPECT_EQ(1u, service_->extensions()->size());
|
| @@ -4356,7 +4358,7 @@ TEST_F(ExtensionServiceTest, DISABLED_LoadExtension) {
|
| std::string id = loaded_[0]->id();
|
| EXPECT_FALSE(unloaded_id_.length());
|
| service_->UninstallExtension(id, false, NULL);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(id, unloaded_id_);
|
| ASSERT_EQ(0u, loaded_.size());
|
| EXPECT_EQ(0u, service_->extensions()->size());
|
| @@ -4369,7 +4371,7 @@ TEST_F(ExtensionServiceTest, GenerateID) {
|
|
|
| base::FilePath no_id_ext = data_dir_.AppendASCII("no_id");
|
| extensions::UnpackedInstaller::Create(service_)->Load(no_id_ext);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| ASSERT_TRUE(Extension::IdIsValid(loaded_[0]->id()));
|
| @@ -4381,7 +4383,7 @@ TEST_F(ExtensionServiceTest, GenerateID) {
|
|
|
| // If we reload the same path, we should get the same extension ID.
|
| extensions::UnpackedInstaller::Create(service_)->Load(no_id_ext);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(1u, loaded_.size());
|
| ASSERT_EQ(previous_id, loaded_[0]->id());
|
| }
|
| @@ -4419,7 +4421,7 @@ void ExtensionServiceTest::TestExternalProvider(
|
| // loaded again.
|
| loaded_.clear();
|
| service_->ReloadExtensions();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(1u, loaded_.size());
|
| ValidatePrefKeyCount(1);
|
| @@ -4448,7 +4450,7 @@ void ExtensionServiceTest::TestExternalProvider(
|
| bool no_uninstall =
|
| management_policy_->MustRemainEnabled(loaded_[0].get(), NULL);
|
| service_->UninstallExtension(id, false, NULL);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| base::FilePath install_path = extensions_install_dir_.AppendASCII(id);
|
| if (no_uninstall) {
|
| @@ -4459,7 +4461,7 @@ void ExtensionServiceTest::TestExternalProvider(
|
| ASSERT_FALSE(base::PathExists(install_path));
|
| loaded_.clear();
|
| service_->CheckForExternalUpdates();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(0u, loaded_.size());
|
| ValidatePrefKeyCount(1);
|
| ValidateIntegerPref(good_crx, "state",
|
| @@ -4489,7 +4491,7 @@ void ExtensionServiceTest::TestExternalProvider(
|
|
|
| loaded_.clear();
|
| service_->OnExternalProviderReady(provider);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(0u, loaded_.size());
|
| ValidatePrefKeyCount(0);
|
|
|
| @@ -4510,7 +4512,7 @@ void ExtensionServiceTest::TestExternalProvider(
|
| // User uninstalls.
|
| loaded_.clear();
|
| service_->UninstallExtension(id, false, NULL);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(0u, loaded_.size());
|
|
|
| // Then remove the extension from the extension provider.
|
| @@ -4519,7 +4521,7 @@ void ExtensionServiceTest::TestExternalProvider(
|
| // Should still be at 0.
|
| loaded_.clear();
|
| extensions::InstalledLoader(service_).LoadAllExtensions();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| ASSERT_EQ(0u, loaded_.size());
|
| ValidatePrefKeyCount(1);
|
|
|
| @@ -4614,7 +4616,7 @@ TEST_F(ExtensionServiceTest, ExternalUninstall) {
|
| // Verify that it's not the disabled extensions flag causing it not to load.
|
| set_extensions_enabled(true);
|
| service_->ReloadExtensions();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| ASSERT_EQ(0u, GetErrors().size());
|
| ASSERT_EQ(0u, loaded_.size());
|
| @@ -4637,7 +4639,7 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) {
|
| provider->set_visit_count(0);
|
| service_->CheckForExternalUpdates();
|
| service_->CheckForExternalUpdates();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Two calls should cause two checks for external extensions.
|
| EXPECT_EQ(2, provider->visit_count());
|
| @@ -4669,7 +4671,7 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) {
|
| provider->set_visit_count(0);
|
| service_->CheckForExternalUpdates();
|
| service_->CheckForExternalUpdates();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Two calls should cause two checks for external extensions.
|
| // Because the external source no longer includes good_crx,
|
| @@ -4941,10 +4943,8 @@ TEST(ExtensionServiceTestSimple, Enabledness) {
|
|
|
| ExtensionErrorReporter::Init(false); // no noisy errors
|
| ExtensionsReadyRecorder recorder;
|
| + content::TestBrowserThreadBundle thread_bundle;
|
| scoped_ptr<TestingProfile> profile(new TestingProfile());
|
| - base::MessageLoop loop;
|
| - content::TestBrowserThread ui_thread(BrowserThread::UI, &loop);
|
| - content::TestBrowserThread file_thread(BrowserThread::FILE, &loop);
|
| #if defined OS_CHROMEOS
|
| chromeos::ScopedTestDeviceSettingsService device_settings_service;
|
| chromeos::ScopedTestCrosSettings cros_settings;
|
| @@ -4965,7 +4965,7 @@ TEST(ExtensionServiceTestSimple, Enabledness) {
|
| false);
|
| EXPECT_TRUE(service->extensions_enabled());
|
| service->Init();
|
| - loop.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(recorder.ready());
|
| #if defined OS_CHROMEOS
|
| user_manager.reset();
|
| @@ -4983,7 +4983,7 @@ TEST(ExtensionServiceTestSimple, Enabledness) {
|
| false);
|
| EXPECT_FALSE(service->extensions_enabled());
|
| service->Init();
|
| - loop.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(recorder.ready());
|
|
|
| recorder.set_ready(false);
|
| @@ -4997,7 +4997,7 @@ TEST(ExtensionServiceTestSimple, Enabledness) {
|
| false);
|
| EXPECT_FALSE(service->extensions_enabled());
|
| service->Init();
|
| - loop.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(recorder.ready());
|
|
|
| recorder.set_ready(false);
|
| @@ -5012,14 +5012,14 @@ TEST(ExtensionServiceTestSimple, Enabledness) {
|
| false);
|
| EXPECT_FALSE(service->extensions_enabled());
|
| service->Init();
|
| - loop.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(recorder.ready());
|
|
|
| // Explicitly delete all the resources used in this test.
|
| profile.reset();
|
| service = NULL;
|
| // Execute any pending deletion tasks.
|
| - loop.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| // Test loading extensions that require limited and unlimited storage quotas.
|
| @@ -5044,7 +5044,7 @@ TEST_F(ExtensionServiceTest, StorageQuota) {
|
| extensions::UnpackedInstaller::Create(service_)->Load(limited_quota_ext);
|
| extensions::UnpackedInstaller::Create(service_)->Load(unlimited_quota_ext);
|
| extensions::UnpackedInstaller::Create(service_)->Load(unlimited_quota_ext2);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| ASSERT_EQ(3u, loaded_.size());
|
| EXPECT_TRUE(profile_.get());
|
| @@ -6210,7 +6210,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) {
|
| InstallCRX(path, INSTALL_NEW);
|
|
|
| service_->CheckForExternalUpdates();
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
| EXPECT_FALSE(extensions::HasExternalInstallError(service_));
|
|
|
| // A hosted app, installed externally.
|
| @@ -6385,7 +6385,7 @@ TEST_F(ExtensionServiceTest, InstallBlacklistedExtension) {
|
| false /* has requirement errors */,
|
| extensions::Blacklist::BLACKLISTED,
|
| false /* wait for idle */);
|
| - loop_.RunUntilIdle();
|
| + base::RunLoop().RunUntilIdle();
|
|
|
| // Extension was installed but not loaded.
|
| EXPECT_TRUE(notifications.CheckNotifications(
|
|
|