| Index: chrome/test/live_sync/live_extensions_sync_test.cc
|
| diff --git a/chrome/test/live_sync/live_extensions_sync_test.cc b/chrome/test/live_sync/live_extensions_sync_test.cc
|
| index 65e5d3d9da5619659712518fea0dd5b51735f73f..97115191743060b5a173c8890bb50812df4c842e 100644
|
| --- a/chrome/test/live_sync/live_extensions_sync_test.cc
|
| +++ b/chrome/test/live_sync/live_extensions_sync_test.cc
|
| @@ -8,27 +8,21 @@
|
| #include <string>
|
|
|
| #include "base/logging.h"
|
| -#include "base/memory/ref_counted.h"
|
| +#include "base/string_number_conversions.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/browser/themes/theme_service.h"
|
| #include "chrome/common/extensions/extension.h"
|
|
|
| LiveExtensionsSyncTest::LiveExtensionsSyncTest(TestType test_type)
|
| - : LiveExtensionsSyncTestBase(test_type) {}
|
| + : LiveSyncTest(test_type) {}
|
|
|
| LiveExtensionsSyncTest::~LiveExtensionsSyncTest() {}
|
|
|
| -bool LiveExtensionsSyncTest::HasSameExtensionsAsVerifier(int profile) {
|
| - return HasSameExtensionsHelper(GetProfile(profile),
|
| - verifier());
|
| -}
|
| +bool LiveExtensionsSyncTest::SetupClients() {
|
| + if (!LiveSyncTest::SetupClients())
|
| + return false;
|
|
|
| -bool LiveExtensionsSyncTest::AllProfilesHaveSameExtensionsAsVerifier() {
|
| - for (int i = 0; i < num_clients(); ++i) {
|
| - if (!HasSameExtensionsAsVerifier(i))
|
| - return false;
|
| - }
|
| + extension_helper_.Setup(this);
|
| return true;
|
| }
|
|
|
| @@ -39,19 +33,26 @@ enum ExtensionState { DISABLED, PENDING, ENABLED };
|
| typedef std::map<std::string, ExtensionState> ExtensionStateMap;
|
|
|
| ExtensionStateMap GetExtensionStates(ExtensionService* extensions_service) {
|
| - ExtensionStateMap extension_states;
|
| + const std::string& profile_name =
|
| + extensions_service->profile()->GetPath().BaseName().MaybeAsASCII();
|
| +
|
| + ExtensionStateMap extension_state_map;
|
|
|
| const ExtensionList* extensions = extensions_service->extensions();
|
| for (ExtensionList::const_iterator it = extensions->begin();
|
| it != extensions->end(); ++it) {
|
| - extension_states[(*it)->id()] = ENABLED;
|
| + extension_state_map[(*it)->id()] = ENABLED;
|
| + VLOG(2) << "Extension " << (*it)->id() << " in profile "
|
| + << profile_name << " is enabled";
|
| }
|
|
|
| const ExtensionList* disabled_extensions =
|
| extensions_service->disabled_extensions();
|
| for (ExtensionList::const_iterator it = disabled_extensions->begin();
|
| it != disabled_extensions->end(); ++it) {
|
| - extension_states[(*it)->id()] = DISABLED;
|
| + extension_state_map[(*it)->id()] = DISABLED;
|
| + VLOG(2) << "Extension " << (*it)->id() << " in profile "
|
| + << profile_name << " is disabled";
|
| }
|
|
|
| const PendingExtensionManager* pending_extension_manager =
|
| @@ -59,19 +60,37 @@ ExtensionStateMap GetExtensionStates(ExtensionService* extensions_service) {
|
| PendingExtensionManager::const_iterator it;
|
| for (it = pending_extension_manager->begin();
|
| it != pending_extension_manager->end(); ++it) {
|
| - extension_states[it->first] = PENDING;
|
| + extension_state_map[it->first] = PENDING;
|
| + VLOG(2) << "Extension " << it->first << " in profile "
|
| + << profile_name << " is pending";
|
| }
|
|
|
| - return extension_states;
|
| + return extension_state_map;
|
| }
|
|
|
| } // namespace
|
|
|
| -bool LiveExtensionsSyncTest::HasSameExtensionsHelper(
|
| - Profile* profile1, Profile* profile2) {
|
| - ExtensionStateMap extension_states1(
|
| - GetExtensionStates(profile1->GetExtensionService()));
|
| - ExtensionStateMap extension_states2(
|
| - GetExtensionStates(profile2->GetExtensionService()));
|
| - return extension_states1 == extension_states2;
|
| +bool LiveExtensionsSyncTest::AllProfilesHaveSameExtensionsAsVerifier() {
|
| + ExtensionStateMap verifier_extension_state_map(
|
| + GetExtensionStates(verifier()->GetExtensionService()));
|
| + for (int i = 0; i < num_clients(); ++i) {
|
| + ExtensionStateMap extension_state_map(
|
| + GetExtensionStates(GetProfile(i)->GetExtensionService()));
|
| + if (extension_state_map != verifier_extension_state_map) {
|
| + return false;
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +void LiveExtensionsSyncTest::InstallExtension(Profile* profile, int index) {
|
| + std::string name = "fakeextension" + base::IntToString(index);
|
| + return extension_helper_.InstallExtension(
|
| + profile, name, Extension::TYPE_EXTENSION);
|
| +}
|
| +
|
| +void LiveExtensionsSyncTest::InstallExtensionsPendingForSync(
|
| + Profile* profile) {
|
| + extension_helper_.InstallExtensionsPendingForSync(
|
| + profile, Extension::TYPE_EXTENSION);
|
| }
|
|
|