| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <algorithm> | |
| 6 #include <vector> | |
| 7 | |
| 8 #include "base/command_line.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/strings/string_util.h" | |
| 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | |
| 12 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | |
| 13 #include "chrome/browser/sync/profile_sync_service.h" | |
| 14 #include "chrome/browser/sync/profile_sync_service_android.h" | |
| 15 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" | |
| 16 #include "chrome/test/base/testing_profile.h" | |
| 17 #include "components/signin/core/browser/profile_oauth2_token_service.h" | |
| 18 #include "components/sync_driver/data_type_controller.h" | |
| 19 #include "content/public/test/test_browser_thread_bundle.h" | |
| 20 #include "sync/internal_api/public/base/model_type.h" | |
| 21 #include "testing/gtest/include/gtest/gtest.h" | |
| 22 | |
| 23 class ProfileSyncServiceAndroidTest : public testing::Test { | |
| 24 public: | |
| 25 ProfileSyncServiceAndroidTest() | |
| 26 : command_line_(base::CommandLine::NO_PROGRAM) {} | |
| 27 ~ProfileSyncServiceAndroidTest() override {} | |
| 28 | |
| 29 void SetUp() override { | |
| 30 ProfileOAuth2TokenService* token_service = | |
| 31 ProfileOAuth2TokenServiceFactory::GetForProfile(&profile_); | |
| 32 ProfileSyncComponentsFactory* factory = | |
| 33 new ProfileSyncComponentsFactoryImpl( | |
| 34 &profile_, | |
| 35 &command_line_, | |
| 36 GURL(), | |
| 37 token_service, | |
| 38 profile_.GetRequestContext()); | |
| 39 sync_service_.reset(new ProfileSyncService( | |
| 40 make_scoped_ptr(factory), | |
| 41 &profile_, | |
| 42 scoped_ptr<SupervisedUserSigninManagerWrapper>(), | |
| 43 token_service, | |
| 44 browser_sync::MANUAL_START)); | |
| 45 factory->RegisterDataTypes(sync_service_.get()); | |
| 46 } | |
| 47 | |
| 48 protected: | |
| 49 syncer::ModelTypeSet GetRegisteredDataTypes() { | |
| 50 sync_driver::DataTypeController::StateMap controller_states; | |
| 51 sync_service_->GetDataTypeControllerStates(&controller_states); | |
| 52 syncer::ModelTypeSet model_types; | |
| 53 for (sync_driver::DataTypeController::StateMap::const_iterator it = | |
| 54 controller_states.begin(); | |
| 55 it != controller_states.end(); ++it) { | |
| 56 model_types.Put(it->first); | |
| 57 } | |
| 58 return model_types; | |
| 59 } | |
| 60 | |
| 61 private: | |
| 62 base::CommandLine command_line_; | |
| 63 content::TestBrowserThreadBundle thread_bundle_; | |
| 64 TestingProfile profile_; | |
| 65 scoped_ptr<ProfileSyncService> sync_service_; | |
| 66 }; | |
| OLD | NEW |