Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: chrome/browser/extensions/api/sessions/sessions_apitest.cc

Issue 401433003: Revert of Sync: Refactoring of DEVICE_INFO syncable type - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d64d29759a63d12e554999e6ee42c746c6229fff..cc208d22acc41d70e8295bf411b965d1d16fef9d 100644
--- a/chrome/browser/extensions/api/sessions/sessions_apitest.cc
+++ b/chrome/browser/extensions/api/sessions/sessions_apitest.cc
@@ -11,9 +11,7 @@
#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"
@@ -87,9 +85,6 @@
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
virtual void SetUpOnMainThread() OVERRIDE;
protected:
- static KeyedService* BuildProfileSyncService(
- content::BrowserContext* profile);
-
void CreateTestProfileSyncService();
void CreateTestExtension();
void CreateSessionModels();
@@ -116,25 +111,6 @@
void ExtensionSessionsTest::SetUpOnMainThread() {
CreateTestProfileSyncService();
CreateTestExtension();
-}
-
-KeyedService* ExtensionSessionsTest::BuildProfileSyncService(
- content::BrowserContext* profile) {
-
- ProfileSyncComponentsFactoryMock* factory =
- new ProfileSyncComponentsFactoryMock();
-
- ON_CALL(*factory, CreateLocalDeviceInfoProviderMock()).WillByDefault(
- testing::Return(new browser_sync::LocalDeviceInfoProviderMock(
- kSessionTags[0],
- "machine name",
- "Chromium 10k",
- "Chrome 10k",
- sync_pb::SyncEnums_DeviceType_TYPE_LINUX)));
-
- return new ProfileSyncServiceMock(
- scoped_ptr<ProfileSyncComponentsFactory>(factory),
- static_cast<Profile*>(profile));
}
void ExtensionSessionsTest::CreateTestProfileSyncService() {
@@ -149,7 +125,7 @@
profile_manager->RegisterTestingProfile(profile, true, false);
ProfileSyncServiceMock* service = static_cast<ProfileSyncServiceMock*>(
ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
- profile, &ExtensionSessionsTest::BuildProfileSyncService));
+ profile, &ProfileSyncServiceMock::BuildMockProfileSyncService));
browser_ = new Browser(Browser::CreateParams(
profile, chrome::HOST_DESKTOP_TYPE_NATIVE));
@@ -166,6 +142,15 @@
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)));
+ 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());

Powered by Google App Engine
This is Rietveld 408576698