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

Side by Side Diff: chrome/browser/sync/sync_startup_tracker_unittest.cc

Issue 1882243004: Convert //chrome/browser/sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/memory/scoped_ptr.h" 5 #include "chrome/browser/sync/sync_startup_tracker.h"
6
7 #include <memory>
8
6 #include "chrome/browser/sync/profile_sync_service_factory.h" 9 #include "chrome/browser/sync/profile_sync_service_factory.h"
7 #include "chrome/browser/sync/profile_sync_test_util.h" 10 #include "chrome/browser/sync/profile_sync_test_util.h"
8 #include "chrome/browser/sync/sync_startup_tracker.h"
9 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
10 #include "content/public/test/test_browser_thread_bundle.h" 12 #include "content/public/test/test_browser_thread_bundle.h"
11 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 using ::testing::_; 16 using ::testing::_;
15 using ::testing::AnyNumber; 17 using ::testing::AnyNumber;
16 using ::testing::Mock; 18 using ::testing::Mock;
17 using ::testing::Return; 19 using ::testing::Return;
18 using ::testing::ReturnRef; 20 using ::testing::ReturnRef;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 .WillRepeatedly(ReturnRef(no_error_)); 56 .WillRepeatedly(ReturnRef(no_error_));
55 EXPECT_CALL(*mock_pss_, IsBackendInitialized()) 57 EXPECT_CALL(*mock_pss_, IsBackendInitialized())
56 .WillRepeatedly(Return(false)); 58 .WillRepeatedly(Return(false));
57 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) 59 EXPECT_CALL(*mock_pss_, HasUnrecoverableError())
58 .WillRepeatedly(Return(false)); 60 .WillRepeatedly(Return(false));
59 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); 61 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true));
60 } 62 }
61 63
62 content::TestBrowserThreadBundle thread_bundle_; 64 content::TestBrowserThreadBundle thread_bundle_;
63 GoogleServiceAuthError no_error_; 65 GoogleServiceAuthError no_error_;
64 scoped_ptr<TestingProfile> profile_; 66 std::unique_ptr<TestingProfile> profile_;
65 ProfileSyncServiceMock* mock_pss_; 67 ProfileSyncServiceMock* mock_pss_;
66 MockObserver observer_; 68 MockObserver observer_;
67 }; 69 };
68 70
69 TEST_F(SyncStartupTrackerTest, SyncAlreadyInitialized) { 71 TEST_F(SyncStartupTrackerTest, SyncAlreadyInitialized) {
70 EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(true)); 72 EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(true));
71 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); 73 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true));
72 EXPECT_CALL(observer_, SyncStartupCompleted()); 74 EXPECT_CALL(observer_, SyncStartupCompleted());
73 SyncStartupTracker tracker(profile_.get(), &observer_); 75 SyncStartupTracker tracker(profile_.get(), &observer_);
74 } 76 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); 141 EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false));
140 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); 142 EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true));
141 GoogleServiceAuthError error( 143 GoogleServiceAuthError error(
142 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 144 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
143 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); 145 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error));
144 EXPECT_CALL(observer_, SyncStartupFailed()); 146 EXPECT_CALL(observer_, SyncStartupFailed());
145 tracker.OnStateChanged(); 147 tracker.OnStateChanged();
146 } 148 }
147 149
148 } // namespace 150 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error_unittest.cc ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698