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/supervised_user_registration_utility.h" | 5 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 registration_utility_.reset( | 208 registration_utility_.reset( |
209 SupervisedUserRegistrationUtility::CreateImpl(prefs(), | 209 SupervisedUserRegistrationUtility::CreateImpl(prefs(), |
210 token_fetcher.Pass(), | 210 token_fetcher.Pass(), |
211 service(), | 211 service(), |
212 shared_settings_service())); | 212 shared_settings_service())); |
213 return registration_utility_.get(); | 213 return registration_utility_.get(); |
214 } | 214 } |
215 | 215 |
216 void SupervisedUserRegistrationUtilityTest::Acknowledge() { | 216 void SupervisedUserRegistrationUtilityTest::Acknowledge() { |
217 SyncChangeList new_changes; | 217 SyncChangeList new_changes; |
218 const SyncChangeList& changes = change_processor()->changes(); | 218 for (const SyncChange& sync_change : change_processor()->changes()) { |
219 for (SyncChangeList::const_iterator it = changes.begin(); it != changes.end(); | 219 EXPECT_EQ(SyncChange::ACTION_ADD, sync_change.change_type()); |
220 ++it) { | 220 ::sync_pb::EntitySpecifics specifics = |
221 EXPECT_EQ(SyncChange::ACTION_ADD, it->change_type()); | 221 sync_change.sync_data().GetSpecifics(); |
222 ::sync_pb::EntitySpecifics specifics = it->sync_data().GetSpecifics(); | |
223 EXPECT_FALSE(specifics.managed_user().acknowledged()); | 222 EXPECT_FALSE(specifics.managed_user().acknowledged()); |
224 specifics.mutable_managed_user()->set_acknowledged(true); | 223 specifics.mutable_managed_user()->set_acknowledged(true); |
225 new_changes.push_back( | 224 new_changes.push_back( |
226 SyncChange(FROM_HERE, | 225 SyncChange(FROM_HERE, |
227 SyncChange::ACTION_UPDATE, | 226 SyncChange::ACTION_UPDATE, |
228 SyncData::CreateRemoteData( | 227 SyncData::CreateRemoteData( |
229 ++sync_data_id_, | 228 ++sync_data_id_, |
230 specifics, | 229 specifics, |
231 base::Time(), | 230 base::Time(), |
232 syncer::AttachmentIdList(), | 231 syncer::AttachmentIdList(), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(), | 294 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(), |
296 SupervisedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17), | 295 SupervisedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17), |
297 GetRegistrationCallback()); | 296 GetRegistrationCallback()); |
298 EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); | 297 EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); |
299 service()->StopSyncing(SUPERVISED_USERS); | 298 service()->StopSyncing(SUPERVISED_USERS); |
300 EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); | 299 EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); |
301 EXPECT_TRUE(received_callback()); | 300 EXPECT_TRUE(received_callback()); |
302 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state()); | 301 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state()); |
303 EXPECT_EQ(std::string(), token()); | 302 EXPECT_EQ(std::string(), token()); |
304 } | 303 } |
OLD | NEW |