This source file includes following definitions.
- IsExtensionAtVersion
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- finished_
- started
- finished
- updates
- Reset
- Observe
- OnFinished
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/stl_util.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/extensions/external_policy_loader.h"
#include "chrome/browser/extensions/updater/extension_downloader.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/test/browser_test_utils.h"
#include "content/test/net/url_request_prepackaged_interceptor.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/pref_names.h"
#include "net/url_request/url_fetcher.h"
using extensions::Extension;
using extensions::ExtensionRegistry;
using extensions::Manifest;
class ExtensionManagementTest : public ExtensionBrowserTest {
protected:
bool IsExtensionAtVersion(const Extension* extension,
const std::string& expected_version) {
extensions::ProcessManager* manager =
extensions::ExtensionSystem::Get(browser()->profile())->
process_manager();
extensions::ExtensionHost* ext_host =
manager->GetBackgroundHostForExtension(extension->id());
EXPECT_TRUE(ext_host);
if (!ext_host)
return false;
std::string version_from_bg;
bool exec = content::ExecuteScriptAndExtractString(
ext_host->render_view_host(), "version()", &version_from_bg);
EXPECT_TRUE(exec);
if (!exec)
return false;
if (version_from_bg != expected_version ||
extension->VersionString() != expected_version)
return false;
return true;
}
};
#if defined(OS_LINUX)
#define MAYBE_InstallSameVersion DISABLED_InstallSameVersion
#else
#define MAYBE_InstallSameVersion InstallSameVersion
#endif
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_InstallSameVersion) {
const Extension* extension = InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1);
ASSERT_TRUE(extension);
base::FilePath old_path = extension->path();
extension = InstallExtension(
test_data_dir_.AppendASCII("install/install_same_version.crx"), 0);
ASSERT_TRUE(extension);
base::FilePath new_path = extension->path();
EXPECT_FALSE(IsExtensionAtVersion(extension, "1.0"));
EXPECT_NE(old_path.value(), new_path.value());
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallOlderVersion) {
const Extension* extension = InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1);
ASSERT_TRUE(extension);
ASSERT_FALSE(InstallExtension(
test_data_dir_.AppendASCII("install/install_older_version.crx"), 0));
EXPECT_TRUE(IsExtensionAtVersion(extension, "1.0"));
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallThenCancel) {
const Extension* extension = InstallExtension(
test_data_dir_.AppendASCII("install/install.crx"), 1);
ASSERT_TRUE(extension);
ASSERT_FALSE(StartInstallButCancel(
test_data_dir_.AppendASCII("install/install_v2.crx")));
EXPECT_TRUE(IsExtensionAtVersion(extension, "1.0"));
}
#if defined(OS_WIN)
#define MAYBE_InstallRequiresConfirm DISABLED_InstallRequiresConfirm
#else
#define MAYBE_InstallRequiresConfirm InstallRequiresConfirm
#endif
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_InstallRequiresConfirm) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
std::string id = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
ASSERT_FALSE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 0));
ASSERT_TRUE(service->GetExtensionById(id, true));
UninstallExtension(id);
ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(
test_data_dir_.AppendASCII("good.crx"), 1, browser()));
UninstallExtension(id);
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) {
extensions::ProcessManager* manager =
extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
const size_t size_before = registry->enabled_extensions().size();
std::string extension_id = "bjafgdebaacbbbecmhlhpofkepfkgcpa";
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("good").AppendASCII("Extensions")
.AppendASCII(extension_id)
.AppendASCII("1.0")));
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
EXPECT_EQ(0u, registry->disabled_extensions().size());
EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension_id));
DisableExtension(extension_id);
EXPECT_EQ(size_before, registry->enabled_extensions().size());
EXPECT_EQ(1u, registry->disabled_extensions().size());
EXPECT_FALSE(manager->GetBackgroundHostForExtension(extension_id));
EnableExtension(extension_id);
EXPECT_EQ(size_before + 1, registry->enabled_extensions().size());
EXPECT_EQ(0u, registry->disabled_extensions().size());
EXPECT_TRUE(manager->GetBackgroundHostForExtension(extension_id));
}
class NotificationListener : public content::NotificationObserver {
public:
NotificationListener() : started_(false), finished_(false) {
int types[] = {
chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED,
chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND
};
for (size_t i = 0; i < arraysize(types); i++) {
registrar_.Add(
this, types[i], content::NotificationService::AllSources());
}
}
virtual ~NotificationListener() {}
bool started() { return started_; }
bool finished() { return finished_; }
const std::set<std::string>& updates() { return updates_; }
void Reset() {
started_ = false;
finished_ = false;
updates_.clear();
}
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE {
switch (type) {
case chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED: {
EXPECT_FALSE(started_);
started_ = true;
break;
}
case chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND: {
const std::string& id =
content::Details<extensions::UpdateDetails>(details)->id;
updates_.insert(id);
break;
}
default:
NOTREACHED();
}
}
void OnFinished() {
EXPECT_FALSE(finished_);
finished_ = true;
}
private:
content::NotificationRegistrar registrar_;
bool started_;
bool finished_;
std::set<std::string> updates_;
};
#if defined(OS_WIN)
#define MAYBE_AutoUpdate DISABLED_AutoUpdate
#else
#if defined(ADDRESS_SANITIZER)
#define MAYBE_AutoUpdate DISABLED_AutoUpdate
#else
#define MAYBE_AutoUpdate AutoUpdate
#endif
#endif
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) {
NotificationListener notification_listener;
base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
content::URLLocalHostRequestPrepackagedInterceptor interceptor;
net::URLFetcher::SetEnableInterceptionForTests(true);
interceptor.SetResponseIgnoreQuery(
GURL("http://localhost/autoupdate/manifest"),
basedir.AppendASCII("manifest_v2.xml"));
interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
basedir.AppendASCII("v2.crx"));
ExtensionTestMessageListener listener1("v1 installed", false);
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
const size_t size_before = registry->enabled_extensions().size();
ASSERT_TRUE(registry->disabled_extensions().is_empty());
const Extension* extension =
InstallExtension(basedir.AppendASCII("v1.crx"), 1);
ASSERT_TRUE(extension);
listener1.WaitUntilSatisfied();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extension->id());
ASSERT_EQ("1.0", extension->VersionString());
extensions::ExtensionUpdater::CheckParams params;
params.callback =
base::Bind(&NotificationListener::OnFinished,
base::Unretained(¬ification_listener));
ExtensionTestMessageListener listener2("v2 installed", false);
service->updater()->CheckNow(params);
ASSERT_TRUE(WaitForExtensionInstall());
listener2.WaitUntilSatisfied();
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(
"ogjcoiohnmldgjemafoockdghcjciccf", false);
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
ASSERT_TRUE(notification_listener.started());
ASSERT_TRUE(notification_listener.finished());
ASSERT_TRUE(ContainsKey(notification_listener.updates(),
"ogjcoiohnmldgjemafoockdghcjciccf"));
notification_listener.Reset();
interceptor.SetResponseIgnoreQuery(
GURL("http://localhost/autoupdate/manifest"),
basedir.AppendASCII("manifest_v3.xml"));
interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v3.crx"),
basedir.AppendASCII("v3.crx"));
service->updater()->CheckNow(params);
ASSERT_TRUE(WaitForExtensionInstallError());
ASSERT_TRUE(notification_listener.started());
ASSERT_TRUE(notification_listener.finished());
ASSERT_TRUE(ContainsKey(notification_listener.updates(),
"ogjcoiohnmldgjemafoockdghcjciccf"));
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(
"ogjcoiohnmldgjemafoockdghcjciccf", false);
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
}
#if defined(OS_WIN)
#define MAYBE_AutoUpdateDisabledExtensions DISABLED_AutoUpdateDisabledExtensions
#else
#if defined(ADDRESS_SANITIZER)
#define MAYBE_AutoUpdateDisabledExtensions DISABLED_AutoUpdateDisabledExtensions
#else
#define MAYBE_AutoUpdateDisabledExtensions AutoUpdateDisabledExtensions
#endif
#endif
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
MAYBE_AutoUpdateDisabledExtensions) {
NotificationListener notification_listener;
base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
content::URLLocalHostRequestPrepackagedInterceptor interceptor;
net::URLFetcher::SetEnableInterceptionForTests(true);
interceptor.SetResponseIgnoreQuery(
GURL("http://localhost/autoupdate/manifest"),
basedir.AppendASCII("manifest_v2.xml"));
interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
basedir.AppendASCII("v2.crx"));
ExtensionTestMessageListener listener1("v1 installed", false);
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
const size_t enabled_size_before = registry->enabled_extensions().size();
const size_t disabled_size_before = registry->disabled_extensions().size();
const Extension* extension =
InstallExtension(basedir.AppendASCII("v1.crx"), 1);
ASSERT_TRUE(extension);
listener1.WaitUntilSatisfied();
DisableExtension(extension->id());
ASSERT_EQ(disabled_size_before + 1, registry->disabled_extensions().size());
ASSERT_EQ(enabled_size_before, registry->enabled_extensions().size());
ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extension->id());
ASSERT_EQ("1.0", extension->VersionString());
extensions::ExtensionUpdater::CheckParams params;
params.callback =
base::Bind(&NotificationListener::OnFinished,
base::Unretained(¬ification_listener));
ExtensionTestMessageListener listener2("v2 installed", false);
service->updater()->CheckNow(params);
ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(disabled_size_before + 1, registry->disabled_extensions().size());
ASSERT_EQ(enabled_size_before, registry->enabled_extensions().size());
extension = service->GetExtensionById(
"ogjcoiohnmldgjemafoockdghcjciccf", true);
ASSERT_TRUE(extension);
ASSERT_FALSE(service->GetExtensionById(
"ogjcoiohnmldgjemafoockdghcjciccf", false));
ASSERT_EQ("2.0", extension->VersionString());
ASSERT_FALSE(listener2.was_satisfied());
EnableExtension(extension->id());
listener2.WaitUntilSatisfied();
ASSERT_TRUE(notification_listener.started());
ASSERT_TRUE(notification_listener.finished());
ASSERT_TRUE(ContainsKey(notification_listener.updates(),
"ogjcoiohnmldgjemafoockdghcjciccf"));
notification_listener.Reset();
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf";
extensions::ExtensionUpdater::CheckParams params;
base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
content::URLLocalHostRequestPrepackagedInterceptor interceptor;
net::URLFetcher::SetEnableInterceptionForTests(true);
interceptor.SetResponseIgnoreQuery(
GURL("http://localhost/autoupdate/manifest"),
basedir.AppendASCII("manifest_v2.xml"));
interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
basedir.AppendASCII("v2.crx"));
ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
const size_t size_before = registry->enabled_extensions().size();
ASSERT_TRUE(registry->disabled_extensions().is_empty());
extensions::PendingExtensionManager* pending_extension_manager =
service->pending_extension_manager();
EXPECT_TRUE(pending_extension_manager->AddFromExternalUpdateUrl(
kExtensionId,
std::string(),
GURL("http://localhost/autoupdate/manifest"),
Manifest::EXTERNAL_PREF_DOWNLOAD,
Extension::NO_FLAGS,
false));
service->updater()->CheckNow(params);
ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
UninstallExtension(kExtensionId);
extensions::ExtensionPrefs* extension_prefs =
extensions::ExtensionPrefs::Get(browser()->profile());
EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "Uninstalling should set kill bit on externaly installed extension.";
EXPECT_FALSE(pending_extension_manager->AddFromExternalUpdateUrl(
kExtensionId,
std::string(),
GURL("http://localhost/autoupdate/manifest"),
Manifest::EXTERNAL_PREF_DOWNLOAD,
Extension::NO_FLAGS,
false));
EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId))
<< "External reinstall of a killed extension shouldn't work.";
EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "External reinstall of a killed extension should leave it killed.";
ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v2.crx"), 1));
EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "Reinstalling should clear the kill bit.";
UninstallExtension(kExtensionId);
EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "Uninstalling non-external extension should not set kill bit.";
}
namespace {
const char* kForceInstallNotEmptyHelp =
"A policy may already be controlling the list of force-installed "
"extensions. Please remove all policy settings from your computer "
"before running tests. E.g. from /etc/chromium/policies Linux or "
"from the registry on Windows, etc.";
}
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf";
base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
content::URLLocalHostRequestPrepackagedInterceptor interceptor;
net::URLFetcher::SetEnableInterceptionForTests(true);
interceptor.SetResponseIgnoreQuery(
GURL("http://localhost/autoupdate/manifest"),
basedir.AppendASCII("manifest_v2.xml"));
interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
basedir.AppendASCII("v2.crx"));
ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
const size_t size_before = registry->enabled_extensions().size();
ASSERT_TRUE(registry->disabled_extensions().is_empty());
PrefService* prefs = browser()->profile()->GetPrefs();
const base::DictionaryValue* forcelist =
prefs->GetDictionary(extensions::pref_names::kInstallForceList);
ASSERT_TRUE(forcelist->empty()) << kForceInstallNotEmptyHelp;
{
DictionaryPrefUpdate pref_update(prefs,
extensions::pref_names::kInstallForceList);
base::DictionaryValue* forcelist = pref_update.Get();
extensions::ExternalPolicyLoader::AddExtension(
forcelist, kExtensionId, "http://localhost/autoupdate/manifest");
}
ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
ASSERT_EQ("2.0", extension->VersionString());
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
DisableExtension(kExtensionId);
EXPECT_EQ(size_before + 1, registry->enabled_extensions().size());
EXPECT_EQ(0u, registry->disabled_extensions().size());
UninstallExtension(kExtensionId);
EXPECT_EQ(size_before + 1, registry->enabled_extensions().size());
EXPECT_EQ(0u, registry->disabled_extensions().size());
ExtensionTestMessageListener listener1("ready", false);
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("management/uninstall_extension")));
ASSERT_TRUE(listener1.WaitUntilSatisfied());
EXPECT_EQ(size_before + 2, registry->enabled_extensions().size());
EXPECT_EQ(0u, registry->disabled_extensions().size());
prefs->ClearPref(extensions::pref_names::kInstallForceList);
EXPECT_EQ(size_before + 1, registry->enabled_extensions().size());
EXPECT_FALSE(service->GetExtensionById(kExtensionId, true));
}
#if defined(ADDRESS_SANITIZER) || defined(OS_WIN)
#define MAYBE_PolicyOverridesUserInstall DISABLED_PolicyOverridesUserInstall
#else
#define MAYBE_PolicyOverridesUserInstall PolicyOverridesUserInstall
#endif
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
MAYBE_PolicyOverridesUserInstall) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
const char* kExtensionId = "ogjcoiohnmldgjemafoockdghcjciccf";
extensions::ExtensionUpdater::CheckParams params;
service->updater()->set_default_check_params(params);
const size_t size_before = registry->enabled_extensions().size();
base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
ASSERT_TRUE(registry->disabled_extensions().is_empty());
content::URLLocalHostRequestPrepackagedInterceptor interceptor;
net::URLFetcher::SetEnableInterceptionForTests(true);
interceptor.SetResponseIgnoreQuery(
GURL("http://localhost/autoupdate/manifest"),
basedir.AppendASCII("manifest_v2.xml"));
interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
basedir.AppendASCII("v2.crx"));
PrefService* prefs = browser()->profile()->GetPrefs();
const base::DictionaryValue* forcelist =
prefs->GetDictionary(extensions::pref_names::kInstallForceList);
ASSERT_TRUE(forcelist->empty()) << kForceInstallNotEmptyHelp;
ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v2.crx"), 1));
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
const Extension* extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::INTERNAL, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
{
DictionaryPrefUpdate pref_update(prefs,
extensions::pref_names::kInstallForceList);
extensions::ExternalPolicyLoader::AddExtension(
pref_update.Get(), kExtensionId,
"http://localhost/autoupdate/manifest");
}
ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
prefs->ClearPref(extensions::pref_names::kInstallForceList);
ASSERT_EQ(size_before, registry->enabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, true);
EXPECT_FALSE(extension);
ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v2.crx"), 1));
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::INTERNAL, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
EXPECT_TRUE(registry->disabled_extensions().is_empty());
DisableExtension(kExtensionId);
EXPECT_EQ(1u, registry->disabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, true);
EXPECT_TRUE(extension);
EXPECT_FALSE(service->IsExtensionEnabled(kExtensionId));
{
DictionaryPrefUpdate pref_update(prefs,
extensions::pref_names::kInstallForceList);
base::DictionaryValue* forcelist = pref_update.Get();
extensions::ExternalPolicyLoader::AddExtension(
forcelist, kExtensionId, "http://localhost/autoupdate/manifest");
}
ASSERT_TRUE(WaitForExtensionInstall());
ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
extension = service->GetExtensionById(kExtensionId, false);
ASSERT_TRUE(extension);
EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
EXPECT_TRUE(registry->disabled_extensions().is_empty());
}