| Index: chrome/browser/extensions/api/sessions/sessions_apitest.cc
|
| diff --git a/chrome/browser/extensions/api/sessions/sessions_apitest.cc b/chrome/browser/extensions/api/sessions/sessions_apitest.cc
|
| index fd2a8d6b004290bbb423f169f8c88e0ee1aecbc8..f733c8a093530e3c542fc2b4d8c0577bb2e2a10f 100644
|
| --- a/chrome/browser/extensions/api/sessions/sessions_apitest.cc
|
| +++ b/chrome/browser/extensions/api/sessions/sessions_apitest.cc
|
| @@ -11,7 +11,9 @@
|
| #include "chrome/browser/extensions/extension_apitest.h"
|
| #include "chrome/browser/extensions/extension_function_test_utils.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/browser/sync/glue/local_device_info_provider_mock.h"
|
| #include "chrome/browser/sync/open_tabs_ui_delegate.h"
|
| +#include "chrome/browser/sync/profile_sync_components_factory_mock.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| #include "chrome/browser/sync/profile_sync_service_factory.h"
|
| #include "chrome/browser/sync/profile_sync_service_mock.h"
|
| @@ -85,6 +87,9 @@ class ExtensionSessionsTest : public InProcessBrowserTest {
|
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
|
| virtual void SetUpOnMainThread() OVERRIDE;
|
| protected:
|
| + static KeyedService* BuildProfileSyncService(
|
| + content::BrowserContext* profile);
|
| +
|
| void CreateTestProfileSyncService();
|
| void CreateTestExtension();
|
| void CreateSessionModels();
|
| @@ -113,6 +118,27 @@ void ExtensionSessionsTest::SetUpOnMainThread() {
|
| CreateTestExtension();
|
| }
|
|
|
| +KeyedService* ExtensionSessionsTest::BuildProfileSyncService(
|
| + content::BrowserContext* profile) {
|
| +
|
| + ProfileSyncComponentsFactoryMock* factory =
|
| + new ProfileSyncComponentsFactoryMock();
|
| +
|
| + factory->SetLocalDeviceInfoProvider(
|
| + scoped_ptr<LocalDeviceInfoProvider>(
|
| + new browser_sync::LocalDeviceInfoProviderMock(
|
| + kSessionTags[0],
|
| + "machine name",
|
| + "Chromium 10k",
|
| + "Chrome 10k",
|
| + sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
|
| + "device_id")));
|
| +
|
| + return new ProfileSyncServiceMock(
|
| + scoped_ptr<ProfileSyncComponentsFactory>(factory),
|
| + static_cast<Profile*>(profile));
|
| +}
|
| +
|
| void ExtensionSessionsTest::CreateTestProfileSyncService() {
|
| ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| base::FilePath path;
|
| @@ -125,7 +151,7 @@ void ExtensionSessionsTest::CreateTestProfileSyncService() {
|
| profile_manager->RegisterTestingProfile(profile, true, false);
|
| ProfileSyncServiceMock* service = static_cast<ProfileSyncServiceMock*>(
|
| ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
|
| - profile, &ProfileSyncServiceMock::BuildMockProfileSyncService));
|
| + profile, &ExtensionSessionsTest::BuildProfileSyncService));
|
| browser_ = new Browser(Browser::CreateParams(
|
| profile, chrome::HOST_DESKTOP_TYPE_NATIVE));
|
|
|
| @@ -142,16 +168,7 @@ void ExtensionSessionsTest::CreateTestProfileSyncService() {
|
| testing::ReturnRef(no_error));
|
| ON_CALL(*service, GetActiveDataTypes()).WillByDefault(
|
| testing::Return(preferred_types));
|
| - ON_CALL(*service, GetLocalDeviceInfoMock()).WillByDefault(
|
| - testing::Return(new browser_sync::DeviceInfo(
|
| - std::string(kSessionTags[0]),
|
| - "machine name",
|
| - "Chromium 10k",
|
| - "Chrome 10k",
|
| - sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
|
| - "device_id")));
|
| - ON_CALL(*service, GetLocalSyncCacheGUID()).WillByDefault(
|
| - testing::Return(std::string(kSessionTags[0])));
|
| +
|
| EXPECT_CALL(*service, AddObserver(testing::_)).Times(testing::AnyNumber());
|
| EXPECT_CALL(*service, RemoveObserver(testing::_)).Times(testing::AnyNumber());
|
|
|
|
|