OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "components/browser_sync/profile_sync_service_mock.h" | 10 #include "components/browser_sync/profile_sync_service_mock.h" |
11 #include "components/pref_registry/pref_registry_syncable.h" | 11 #include "components/pref_registry/pref_registry_syncable.h" |
12 #include "components/prefs/pref_registry_simple.h" | 12 #include "components/prefs/pref_registry_simple.h" |
13 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 13 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
14 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 14 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
15 #include "components/signin/core/browser/signin_manager.h" | 15 #include "components/signin/core/browser/signin_manager.h" |
16 #include "components/signin/core/common/signin_pref_names.h" | 16 #include "components/signin/core/common/signin_pref_names.h" |
17 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegat
e.h" | 17 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegat
e.h" |
18 #include "components/syncable_prefs/pref_service_mock_factory.h" | 18 #include "components/sync_preferences/pref_service_mock_factory.h" |
19 #include "components/syncable_prefs/pref_service_syncable.h" | 19 #include "components/sync_preferences/pref_service_syncable.h" |
20 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" | 20 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" |
21 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" | 21 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" |
22 #include "ios/chrome/browser/experimental_flags.h" | 22 #include "ios/chrome/browser/experimental_flags.h" |
23 #include "ios/chrome/browser/pref_names.h" | 23 #include "ios/chrome/browser/pref_names.h" |
24 #include "ios/chrome/browser/prefs/browser_prefs.h" | 24 #include "ios/chrome/browser/prefs/browser_prefs.h" |
25 #include "ios/chrome/browser/signin/account_tracker_service_factory.h" | 25 #include "ios/chrome/browser/signin/account_tracker_service_factory.h" |
26 #import "ios/chrome/browser/signin/authentication_service.h" | 26 #import "ios/chrome/browser/signin/authentication_service.h" |
27 #import "ios/chrome/browser/signin/authentication_service_factory.h" | 27 #import "ios/chrome/browser/signin/authentication_service_factory.h" |
28 #include "ios/chrome/browser/signin/fake_oauth2_token_service_builder.h" | 28 #include "ios/chrome/browser/signin/fake_oauth2_token_service_builder.h" |
29 #include "ios/chrome/browser/signin/fake_signin_manager_builder.h" | 29 #include "ios/chrome/browser/signin/fake_signin_manager_builder.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 static_cast<browser_sync::ProfileSyncServiceMock*>( | 121 static_cast<browser_sync::ProfileSyncServiceMock*>( |
122 IOSChromeProfileSyncServiceFactory::GetForBrowserState( | 122 IOSChromeProfileSyncServiceFactory::GetForBrowserState( |
123 browser_state_.get())); | 123 browser_state_.get())); |
124 sync_setup_service_mock_ = static_cast<SyncSetupServiceMock*>( | 124 sync_setup_service_mock_ = static_cast<SyncSetupServiceMock*>( |
125 SyncSetupServiceFactory::GetForBrowserState(browser_state_.get())); | 125 SyncSetupServiceFactory::GetForBrowserState(browser_state_.get())); |
126 CreateAuthenticationService(); | 126 CreateAuthenticationService(); |
127 OAuth2TokenServiceFactory::GetForBrowserState(browser_state_.get()) | 127 OAuth2TokenServiceFactory::GetForBrowserState(browser_state_.get()) |
128 ->AddObserver(this); | 128 ->AddObserver(this); |
129 } | 129 } |
130 | 130 |
131 std::unique_ptr<syncable_prefs::PrefServiceSyncable> CreatePrefService() { | 131 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreatePrefService() { |
132 syncable_prefs::PrefServiceMockFactory factory; | 132 sync_preferences::PrefServiceMockFactory factory; |
133 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( | 133 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( |
134 new user_prefs::PrefRegistrySyncable); | 134 new user_prefs::PrefRegistrySyncable); |
135 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs = | 135 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs = |
136 factory.CreateSyncable(registry.get()); | 136 factory.CreateSyncable(registry.get()); |
137 RegisterBrowserStatePrefs(registry.get()); | 137 RegisterBrowserStatePrefs(registry.get()); |
138 return prefs; | 138 return prefs; |
139 } | 139 } |
140 | 140 |
141 void TearDown() override { | 141 void TearDown() override { |
142 OAuth2TokenServiceFactory::GetForBrowserState(browser_state_.get()) | 142 OAuth2TokenServiceFactory::GetForBrowserState(browser_state_.get()) |
143 ->RemoveObserver(this); | 143 ->RemoveObserver(this); |
144 authentication_service_->Shutdown(); | 144 authentication_service_->Shutdown(); |
145 authentication_service_.reset(); | 145 authentication_service_.reset(); |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 NSDictionary* user_info = [NSDictionary dictionary]; | 740 NSDictionary* user_info = [NSDictionary dictionary]; |
741 SetCachedMDMInfo(identity_, user_info); | 741 SetCachedMDMInfo(identity_, user_info); |
742 | 742 |
743 EXPECT_CALL(*identity_service_, | 743 EXPECT_CALL(*identity_service_, |
744 HandleMDMNotification(identity_, user_info, _)) | 744 HandleMDMNotification(identity_, user_info, _)) |
745 .WillOnce(Return(true)); | 745 .WillOnce(Return(true)); |
746 | 746 |
747 EXPECT_TRUE( | 747 EXPECT_TRUE( |
748 authentication_service_->ShowMDMErrorDialogForIdentity(identity_)); | 748 authentication_service_->ShowMDMErrorDialogForIdentity(identity_)); |
749 } | 749 } |
OLD | NEW |