| OLD | NEW |
| 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 "chrome/browser/supervised_user/legacy/supervised_user_registration_uti
lity.h" | 5 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_uti
lity.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
| 13 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe
tcher.h" | 15 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe
tcher.h" |
| 14 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" | 16 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" |
| 15 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service_factory.h" | 17 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service_factory.h" |
| 16 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" | 18 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 base::RunLoop run_loop_; | 128 base::RunLoop run_loop_; |
| 127 TestingProfile profile_; | 129 TestingProfile profile_; |
| 128 SupervisedUserSyncService* service_; | 130 SupervisedUserSyncService* service_; |
| 129 SupervisedUserSharedSettingsService* shared_settings_service_; | 131 SupervisedUserSharedSettingsService* shared_settings_service_; |
| 130 scoped_ptr<SupervisedUserRegistrationUtility> registration_utility_; | 132 scoped_ptr<SupervisedUserRegistrationUtility> registration_utility_; |
| 131 | 133 |
| 132 // Owned by the SupervisedUserSyncService. | 134 // Owned by the SupervisedUserSyncService. |
| 133 MockChangeProcessor* change_processor_; | 135 MockChangeProcessor* change_processor_; |
| 134 | 136 |
| 135 // A unique ID for creating "remote" Sync data. | 137 // A unique ID for creating "remote" Sync data. |
| 136 int64 sync_data_id_; | 138 int64_t sync_data_id_; |
| 137 | 139 |
| 138 // Whether OnSupervisedUserRegistered has been called. | 140 // Whether OnSupervisedUserRegistered has been called. |
| 139 bool received_callback_; | 141 bool received_callback_; |
| 140 | 142 |
| 141 // Hold the registration result (either an error, or a token). | 143 // Hold the registration result (either an error, or a token). |
| 142 GoogleServiceAuthError error_; | 144 GoogleServiceAuthError error_; |
| 143 std::string token_; | 145 std::string token_; |
| 144 | 146 |
| 145 base::WeakPtrFactory<SupervisedUserRegistrationUtilityTest> weak_ptr_factory_; | 147 base::WeakPtrFactory<SupervisedUserRegistrationUtilityTest> weak_ptr_factory_; |
| 146 }; | 148 }; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(), | 294 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(), |
| 293 SupervisedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17), | 295 SupervisedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17), |
| 294 GetRegistrationCallback()); | 296 GetRegistrationCallback()); |
| 295 EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); | 297 EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); |
| 296 service()->StopSyncing(SUPERVISED_USERS); | 298 service()->StopSyncing(SUPERVISED_USERS); |
| 297 EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); | 299 EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); |
| 298 EXPECT_TRUE(received_callback()); | 300 EXPECT_TRUE(received_callback()); |
| 299 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state()); | 301 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state()); |
| 300 EXPECT_EQ(std::string(), token()); | 302 EXPECT_EQ(std::string(), token()); |
| 301 } | 303 } |
| OLD | NEW |