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

Side by Side Diff: chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "components/sync_sessions/sessions_sync_manager.h" 5 #include "components/sync_sessions/sessions_sync_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/memory/ptr_util.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "build/build_config.h" 13 #include "build/build_config.h"
13 #include "chrome/browser/sessions/session_tab_helper.h" 14 #include "chrome/browser/sessions/session_tab_helper.h"
14 #include "chrome/browser/sync/chrome_sync_client.h" 15 #include "chrome/browser/sync/chrome_sync_client.h"
15 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" 16 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h"
16 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" 17 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h"
17 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" 18 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/test/base/browser_with_test_window_test.h" 20 #include "chrome/test/base/browser_with_test_window_test.h"
20 #include "components/sessions/content/content_serialized_navigation_builder.h" 21 #include "components/sessions/content/content_serialized_navigation_builder.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 SyncedWindowDelegatesGetter* synced_window_getter_; 303 SyncedWindowDelegatesGetter* synced_window_getter_;
303 }; 304 };
304 305
305 } // namespace 306 } // namespace
306 307
307 class SessionsSyncManagerTest 308 class SessionsSyncManagerTest
308 : public BrowserWithTestWindowTest { 309 : public BrowserWithTestWindowTest {
309 protected: 310 protected:
310 SessionsSyncManagerTest() 311 SessionsSyncManagerTest()
311 : test_processor_(NULL) { 312 : test_processor_(NULL) {
312 local_device_.reset(new LocalDeviceInfoProviderMock( 313 local_device_ = base::MakeUnique<LocalDeviceInfoProviderMock>(
313 "cache_guid", 314 "cache_guid", "Wayne Gretzky's Hacking Box", "Chromium 10k",
314 "Wayne Gretzky's Hacking Box", 315 "Chrome 10k", sync_pb::SyncEnums_DeviceType_TYPE_LINUX, "device_id");
315 "Chromium 10k",
316 "Chrome 10k",
317 sync_pb::SyncEnums_DeviceType_TYPE_LINUX,
318 "device_id"));
319 } 316 }
320 317
321 void SetUp() override { 318 void SetUp() override {
322 BrowserWithTestWindowTest::SetUp(); 319 BrowserWithTestWindowTest::SetUp();
323 sync_client_.reset(new browser_sync::ChromeSyncClient(profile())); 320 sync_client_ = base::MakeUnique<browser_sync::ChromeSyncClient>(profile());
324 sessions_client_shim_.reset( 321 sessions_client_shim_ = base::MakeUnique<SyncSessionsClientShim>(
325 new SyncSessionsClientShim(sync_client_->GetSyncSessionsClient())); 322 sync_client_->GetSyncSessionsClient());
326 NotificationServiceSessionsRouter* router( 323 NotificationServiceSessionsRouter* router(
327 new NotificationServiceSessionsRouter( 324 new NotificationServiceSessionsRouter(
328 profile(), GetSyncSessionsClient(), 325 profile(), GetSyncSessionsClient(),
329 syncer::SyncableService::StartSyncFlare())); 326 syncer::SyncableService::StartSyncFlare()));
330 sync_prefs_.reset(new syncer::SyncPrefs(profile()->GetPrefs())); 327 sync_prefs_ = base::MakeUnique<syncer::SyncPrefs>(profile()->GetPrefs());
331 manager_.reset(new SessionsSyncManager( 328 manager_ = base::MakeUnique<SessionsSyncManager>(
332 GetSyncSessionsClient(), sync_prefs_.get(), local_device_.get(), 329 GetSyncSessionsClient(), sync_prefs_.get(), local_device_.get(),
333 std::unique_ptr<LocalSessionEventRouter>(router), 330 std::unique_ptr<LocalSessionEventRouter>(router),
334 base::Bind(&SessionNotificationObserver::NotifyOfUpdate, 331 base::Bind(&SessionNotificationObserver::NotifyOfUpdate,
335 base::Unretained(&observer_)), 332 base::Unretained(&observer_)),
336 base::Bind(&SessionNotificationObserver::NotifyOfRefresh, 333 base::Bind(&SessionNotificationObserver::NotifyOfRefresh,
337 base::Unretained(&observer_)))); 334 base::Unretained(&observer_)));
338 } 335 }
339 336
340 void TearDown() override { 337 void TearDown() override {
341 test_processor_ = NULL; 338 test_processor_ = NULL;
342 helper()->Reset(); 339 helper()->Reset();
343 sync_prefs_.reset(); 340 sync_prefs_.reset();
344 manager_.reset(); 341 manager_.reset();
345 BrowserWithTestWindowTest::TearDown(); 342 BrowserWithTestWindowTest::TearDown();
346 } 343 }
347 344
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 base::Time last_time; 2604 base::Time last_time;
2608 for (size_t i = 0; i < tabs.size(); ++i) { 2605 for (size_t i = 0; i < tabs.size(); ++i) {
2609 base::Time this_time = tabs[i]->timestamp; 2606 base::Time this_time = tabs[i]->timestamp;
2610 if (i > 0) 2607 if (i > 0)
2611 ASSERT_GE(last_time, this_time); 2608 ASSERT_GE(last_time, this_time);
2612 last_time = tabs[i]->timestamp; 2609 last_time = tabs[i]->timestamp;
2613 } 2610 }
2614 } 2611 }
2615 2612
2616 } // namespace sync_sessions 2613 } // namespace sync_sessions
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_android.cc ('k') | chrome/browser/sync/sync_error_notifier_ash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698