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

Side by Side Diff: trunk/src/chrome/browser/sync/profile_sync_service_session_unittest.cc

Issue 98323003: Revert 238348 "Clean up TestProfileSyncService and related tests" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/guid.h" 13 #include "base/guid.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/invalidation/invalidation_service_factory.h" 20 #include "chrome/browser/invalidation/invalidation_service_factory.h"
21 #include "chrome/browser/sessions/session_tab_helper.h" 21 #include "chrome/browser/sessions/session_tab_helper.h"
22 #include "chrome/browser/signin/profile_oauth2_token_service.h"
23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
24 #include "chrome/browser/signin/signin_manager.h" 22 #include "chrome/browser/signin/signin_manager.h"
25 #include "chrome/browser/signin/signin_manager_factory.h" 23 #include "chrome/browser/signin/signin_manager_factory.h"
26 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 24 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
27 #include "chrome/browser/sync/fake_oauth2_token_service.h" 25 #include "chrome/browser/sync/fake_oauth2_token_service.h"
28 #include "chrome/browser/sync/glue/device_info.h" 26 #include "chrome/browser/sync/glue/device_info.h"
29 #include "chrome/browser/sync/glue/session_change_processor.h" 27 #include "chrome/browser/sync/glue/session_change_processor.h"
30 #include "chrome/browser/sync/glue/session_data_type_controller.h" 28 #include "chrome/browser/sync/glue/session_data_type_controller.h"
31 #include "chrome/browser/sync/glue/session_model_associator.h" 29 #include "chrome/browser/sync/glue/session_model_associator.h"
32 #include "chrome/browser/sync/glue/session_sync_test_helper.h" 30 #include "chrome/browser/sync/glue/session_sync_test_helper.h"
33 #include "chrome/browser/sync/glue/sync_backend_host.h" 31 #include "chrome/browser/sync/glue/sync_backend_host.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 77
80 namespace { 78 namespace {
81 79
82 class FakeProfileSyncService : public TestProfileSyncService { 80 class FakeProfileSyncService : public TestProfileSyncService {
83 public: 81 public:
84 FakeProfileSyncService( 82 FakeProfileSyncService(
85 ProfileSyncComponentsFactory* factory, 83 ProfileSyncComponentsFactory* factory,
86 Profile* profile, 84 Profile* profile,
87 SigninManagerBase* signin, 85 SigninManagerBase* signin,
88 ProfileOAuth2TokenService* oauth2_token_service, 86 ProfileOAuth2TokenService* oauth2_token_service,
89 ProfileSyncService::StartBehavior behavior) 87 ProfileSyncService::StartBehavior behavior,
88 bool synchronous_backend_initialization)
90 : TestProfileSyncService(factory, 89 : TestProfileSyncService(factory,
91 profile, 90 profile,
92 signin, 91 signin,
93 oauth2_token_service, 92 oauth2_token_service,
94 behavior) {} 93 behavior,
94 synchronous_backend_initialization) {}
95 virtual ~FakeProfileSyncService() {} 95 virtual ~FakeProfileSyncService() {}
96 96
97 virtual scoped_ptr<DeviceInfo> GetLocalDeviceInfo() const OVERRIDE { 97 virtual scoped_ptr<DeviceInfo> GetLocalDeviceInfo() const OVERRIDE {
98 return scoped_ptr<DeviceInfo>(new DeviceInfo(base::GenerateGUID(), 98 return scoped_ptr<DeviceInfo>(new DeviceInfo(base::GenerateGUID(),
99 "client_name", 99 "client_name",
100 std::string(), 100 std::string(),
101 std::string(), 101 std::string(),
102 sync_pb::SyncEnums::TYPE_WIN)); 102 sync_pb::SyncEnums::TYPE_WIN));
103 } 103 }
104 }; 104 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 signin->SetAuthenticatedUsername("test_user"); 191 signin->SetAuthenticatedUsername("test_user");
192 ProfileOAuth2TokenService* oauth2_token_service = 192 ProfileOAuth2TokenService* oauth2_token_service =
193 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()); 193 ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
194 ProfileSyncComponentsFactoryMock* factory = 194 ProfileSyncComponentsFactoryMock* factory =
195 new ProfileSyncComponentsFactoryMock(); 195 new ProfileSyncComponentsFactoryMock();
196 sync_service_.reset(new FakeProfileSyncService( 196 sync_service_.reset(new FakeProfileSyncService(
197 factory, 197 factory,
198 profile(), 198 profile(),
199 signin, 199 signin,
200 oauth2_token_service, 200 oauth2_token_service,
201 ProfileSyncService::AUTO_START)); 201 ProfileSyncService::AUTO_START,
202 false));
202 sync_service_->set_backend_init_callback(callback); 203 sync_service_->set_backend_init_callback(callback);
203 204
204 // Register the session data type. 205 // Register the session data type.
205 SessionDataTypeController *dtc = new SessionDataTypeController(factory, 206 SessionDataTypeController *dtc = new SessionDataTypeController(factory,
206 profile(), 207 profile(),
207 sync_service_.get()); 208 sync_service_.get());
208 sync_service_->RegisterDataTypeController(dtc); 209 sync_service_->RegisterDataTypeController(dtc);
209 210
210 model_associator_ = 211 model_associator_ =
211 new SessionModelAssociator(sync_service_.get(), 212 new SessionModelAssociator(sync_service_.get(),
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 tab_node.SetSessionSpecifics(specifics); 1279 tab_node.SetSessionSpecifics(specifics);
1279 } 1280 }
1280 1281
1281 error = model_associator_->DisassociateModels(); 1282 error = model_associator_->DisassociateModels();
1282 ASSERT_FALSE(error.IsSet()); 1283 ASSERT_FALSE(error.IsSet());
1283 error = model_associator_->AssociateModels(NULL, NULL); 1284 error = model_associator_->AssociateModels(NULL, NULL);
1284 ASSERT_FALSE(error.IsSet()); 1285 ASSERT_FALSE(error.IsSet());
1285 } 1286 }
1286 1287
1287 } // namespace browser_sync 1288 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698