OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 protected: | 69 protected: |
70 Profile* profile() { return profile_.get(); } | 70 Profile* profile() { return profile_.get(); } |
71 FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } | 71 FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } |
72 ArcAuthService* auth_service() { return auth_service_.get(); } | 72 ArcAuthService* auth_service() { return auth_service_.get(); } |
73 | 73 |
74 private: | 74 private: |
75 void StartPreferenceSyncing() const { | 75 void StartPreferenceSyncing() const { |
76 PrefServiceSyncableFromProfile(profile_.get()) | 76 PrefServiceSyncableFromProfile(profile_.get()) |
77 ->GetSyncableService(syncer::PREFERENCES) | 77 ->GetSyncableService(syncer::PREFERENCES) |
78 ->MergeDataAndStartSyncing(syncer::PREFERENCES, syncer::SyncDataList(), | 78 ->MergeDataAndStartSyncing(syncer::PREFERENCES, syncer::SyncDataList(), |
79 scoped_ptr<syncer::SyncChangeProcessor>( | 79 std::unique_ptr<syncer::SyncChangeProcessor>( |
80 new syncer::FakeSyncChangeProcessor), | 80 new syncer::FakeSyncChangeProcessor), |
81 scoped_ptr<syncer::SyncErrorFactory>( | 81 std::unique_ptr<syncer::SyncErrorFactory>( |
82 new syncer::SyncErrorFactoryMock())); | 82 new syncer::SyncErrorFactoryMock())); |
83 } | 83 } |
84 | 84 |
85 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; | 85 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
86 scoped_ptr<arc::FakeArcBridgeService> bridge_service_; | 86 std::unique_ptr<arc::FakeArcBridgeService> bridge_service_; |
87 scoped_ptr<arc::ArcAuthService> auth_service_; | 87 std::unique_ptr<arc::ArcAuthService> auth_service_; |
88 scoped_ptr<TestingProfile> profile_; | 88 std::unique_ptr<TestingProfile> profile_; |
89 base::ScopedTempDir temp_dir_; | 89 base::ScopedTempDir temp_dir_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(ArcAuthServiceTest); | 91 DISALLOW_COPY_AND_ASSIGN(ArcAuthServiceTest); |
92 }; | 92 }; |
93 | 93 |
94 TEST_F(ArcAuthServiceTest, PrefChangeTriggersService) { | 94 TEST_F(ArcAuthServiceTest, PrefChangeTriggersService) { |
95 ASSERT_EQ(ArcAuthService::State::STOPPED, auth_service()->state()); | 95 ASSERT_EQ(ArcAuthService::State::STOPPED, auth_service()->state()); |
96 | 96 |
97 PrefService* pref = profile()->GetPrefs(); | 97 PrefService* pref = profile()->GetPrefs(); |
98 DCHECK_EQ(false, pref->GetBoolean(prefs::kArcEnabled)); | 98 DCHECK_EQ(false, pref->GetBoolean(prefs::kArcEnabled)); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 auth_service()->OnSignInFailed(arc::ArcSignInFailureReason::UNKNOWN_ERROR); | 231 auth_service()->OnSignInFailed(arc::ArcSignInFailureReason::UNKNOWN_ERROR); |
232 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn)); | 232 EXPECT_FALSE(prefs->GetBoolean(prefs::kArcSignedIn)); |
233 EXPECT_EQ(ArcAuthService::State::STOPPED, auth_service()->state()); | 233 EXPECT_EQ(ArcAuthService::State::STOPPED, auth_service()->state()); |
234 EXPECT_EQ(ArcBridgeService::State::STOPPED, bridge_service()->state()); | 234 EXPECT_EQ(ArcBridgeService::State::STOPPED, bridge_service()->state()); |
235 | 235 |
236 // Correctly stop service. | 236 // Correctly stop service. |
237 auth_service()->Shutdown(); | 237 auth_service()->Shutdown(); |
238 } | 238 } |
239 | 239 |
240 } // namespace arc | 240 } // namespace arc |
OLD | NEW |