#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/sync/profile_sync_components_factory_impl.h"
#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/test/base/testing_profile.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/sync_driver/data_type_controller.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "google_apis/gaia/gaia_constants.h"
+#include "google_apis/gaia/oauth2_token_service.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/app_list/app_list_switches.h"
-using browser_sync::DataTypeController;
-using content::BrowserThread;
+using sync_driver::DataTypeController;
class ProfileSyncComponentsFactoryImplTest : public testing::Test {
protected:
ProfileSyncComponentsFactoryImplTest()
- : ui_thread_(BrowserThread::UI, &message_loop_) {}
+ : thread_bundle_(content::TestBrowserThreadBundle::DEFAULT) {}
- virtual void SetUp() {
+ void SetUp() override {
profile_.reset(new TestingProfile());
base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe"));
command_line_.reset(new CommandLine(program_path));
+ scope_set_.insert(GaiaConstants::kChromeSyncOAuth2Scope);
}
// Returns the collection of default datatypes.
std::vector<syncer::ModelType> datatypes;
datatypes.push_back(syncer::APPS);
#if defined(ENABLE_APP_LIST)
- datatypes.push_back(syncer::APP_LIST);
+ if (app_list::switches::IsAppListSyncEnabled())
+ datatypes.push_back(syncer::APP_LIST);
#endif
datatypes.push_back(syncer::APP_SETTINGS);
datatypes.push_back(syncer::AUTOFILL);
datatypes.push_back(syncer::AUTOFILL_PROFILE);
datatypes.push_back(syncer::BOOKMARKS);
+ datatypes.push_back(syncer::DEVICE_INFO);
#if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS)
datatypes.push_back(syncer::DICTIONARY);
#endif
datatypes.push_back(syncer::TYPED_URLS);
datatypes.push_back(syncer::FAVICON_TRACKING);
datatypes.push_back(syncer::FAVICON_IMAGES);
- datatypes.push_back(syncer::SYNCED_NOTIFICATIONS);
- datatypes.push_back(syncer::MANAGED_USERS);
- datatypes.push_back(syncer::MANAGED_USER_SHARED_SETTINGS);
+ datatypes.push_back(syncer::SUPERVISED_USERS);
+ datatypes.push_back(syncer::SUPERVISED_USER_SETTINGS);
+ datatypes.push_back(syncer::SUPERVISED_USER_SHARED_SETTINGS);
return datatypes;
}
void TestSwitchDisablesType(syncer::ModelTypeSet types) {
command_line_->AppendSwitchASCII(switches::kDisableSyncTypes,
syncer::ModelTypeSetToString(types));
- scoped_ptr<ProfileSyncService> pss(
- new ProfileSyncService(
- new ProfileSyncComponentsFactoryImpl(profile_.get(),
- command_line_.get()),
- profile_.get(),
- NULL,
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()),
- browser_sync::MANUAL_START));
+ GURL sync_service_url =
+ ProfileSyncService::GetSyncServiceURL(*command_line_);
+ ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
+ scoped_ptr<ProfileSyncService> pss(new ProfileSyncService(
+ scoped_ptr<ProfileSyncComponentsFactory>(
+ new ProfileSyncComponentsFactoryImpl(
+ profile_.get(),
+ command_line_.get(),
+ ProfileSyncService::GetSyncServiceURL(*command_line_),
+ token_service,
+ profile_->GetRequestContext())),
+ profile_.get(),
+ make_scoped_ptr<SupervisedUserSigninManagerWrapper>(NULL),
+ token_service,
+ browser_sync::MANUAL_START));
pss->factory()->RegisterDataTypes(pss.get());
DataTypeController::StateMap controller_states;
pss->GetDataTypeControllerStates(&controller_states);
CheckDefaultDatatypesInMapExcept(&controller_states, types);
}
- base::MessageLoop message_loop_;
- content::TestBrowserThread ui_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<Profile> profile_;
scoped_ptr<CommandLine> command_line_;
+ OAuth2TokenService::ScopeSet scope_set_;
};
TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) {
+ ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
scoped_ptr<ProfileSyncService> pss(new ProfileSyncService(
- new ProfileSyncComponentsFactoryImpl(profile_.get(), command_line_.get()),
+ scoped_ptr<ProfileSyncComponentsFactory>(
+ new ProfileSyncComponentsFactoryImpl(
+ profile_.get(),
+ command_line_.get(),
+ ProfileSyncService::GetSyncServiceURL(*command_line_),
+ token_service,
+ profile_->GetRequestContext())),
profile_.get(),
- NULL,
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()),
+ make_scoped_ptr<SupervisedUserSigninManagerWrapper>(NULL),
+ token_service,
browser_sync::MANUAL_START));
pss->factory()->RegisterDataTypes(pss.get());
DataTypeController::StateMap controller_states;