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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); | 82 GoogleServiceAuthError error(GoogleServiceAuthError::NONE); |
83 callback.Run(error, kSupervisedUserToken); | 83 callback.Run(error, kSupervisedUserToken); |
84 } | 84 } |
85 }; | 85 }; |
86 | 86 |
87 } // namespace | 87 } // namespace |
88 | 88 |
89 class SupervisedUserRegistrationUtilityTest : public ::testing::Test { | 89 class SupervisedUserRegistrationUtilityTest : public ::testing::Test { |
90 public: | 90 public: |
91 SupervisedUserRegistrationUtilityTest(); | 91 SupervisedUserRegistrationUtilityTest(); |
92 virtual ~SupervisedUserRegistrationUtilityTest(); | 92 ~SupervisedUserRegistrationUtilityTest() override; |
93 | 93 |
94 virtual void TearDown() override; | 94 void TearDown() override; |
95 | 95 |
96 protected: | 96 protected: |
97 scoped_ptr<SyncChangeProcessor> CreateChangeProcessor(); | 97 scoped_ptr<SyncChangeProcessor> CreateChangeProcessor(); |
98 scoped_ptr<SyncErrorFactory> CreateErrorFactory(); | 98 scoped_ptr<SyncErrorFactory> CreateErrorFactory(); |
99 SyncData CreateRemoteData(const std::string& id, const std::string& name); | 99 SyncData CreateRemoteData(const std::string& id, const std::string& name); |
100 | 100 |
101 SyncMergeResult StartInitialSync(); | 101 SyncMergeResult StartInitialSync(); |
102 | 102 |
103 SupervisedUserRegistrationUtility::RegistrationCallback | 103 SupervisedUserRegistrationUtility::RegistrationCallback |
104 GetRegistrationCallback(); | 104 GetRegistrationCallback(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(), | 292 SupervisedUserRegistrationUtility::GenerateNewSupervisedUserId(), |
293 SupervisedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17), | 293 SupervisedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17), |
294 GetRegistrationCallback()); | 294 GetRegistrationCallback()); |
295 EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); | 295 EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); |
296 service()->StopSyncing(SUPERVISED_USERS); | 296 service()->StopSyncing(SUPERVISED_USERS); |
297 EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); | 297 EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size()); |
298 EXPECT_TRUE(received_callback()); | 298 EXPECT_TRUE(received_callback()); |
299 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state()); | 299 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state()); |
300 EXPECT_EQ(std::string(), token()); | 300 EXPECT_EQ(std::string(), token()); |
301 } | 301 } |
OLD | NEW |