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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 \"id\": \"%s\", \ | 41 \"id\": \"%s\", \ |
42 \"email\": \"%s\", \ | 42 \"email\": \"%s\", \ |
43 \"hd\": \"\", \ | 43 \"hd\": \"\", \ |
44 }"; | 44 }"; |
45 | 45 |
46 enum TrackingEventType { | 46 enum TrackingEventType { |
47 UPDATED, | 47 UPDATED, |
48 REMOVED, | 48 REMOVED, |
49 }; | 49 }; |
50 | 50 |
51 std::string AccountIdToEmail(const std::string account_id) { | 51 std::string AccountIdToEmail(const std::string& account_id) { |
52 return account_id + "@gmail.com"; | 52 return account_id + "@gmail.com"; |
53 } | 53 } |
54 | 54 |
55 std::string AccountIdToGaiaId(const std::string account_id) { | 55 std::string AccountIdToGaiaId(const std::string& account_id) { |
56 return "gaia-" + account_id; | 56 return "gaia-" + account_id; |
57 } | 57 } |
58 | 58 |
59 std::string AccountIdToFullName(const std::string account_id) { | 59 std::string AccountIdToFullName(const std::string& account_id) { |
60 return "full-name-" + account_id; | 60 return "full-name-" + account_id; |
61 } | 61 } |
62 | 62 |
63 std::string AccountIdToGivenName(const std::string account_id) { | 63 std::string AccountIdToGivenName(const std::string& account_id) { |
64 return "given-name-" + account_id; | 64 return "given-name-" + account_id; |
65 } | 65 } |
66 | 66 |
67 std::string AccountIdToLocale(const std::string account_id) { | 67 std::string AccountIdToLocale(const std::string& account_id) { |
68 return "locale-" + account_id; | 68 return "locale-" + account_id; |
69 } | 69 } |
70 | 70 |
71 std::string AccountIdToPictureURL(const std::string account_id) { | 71 std::string AccountIdToPictureURL(const std::string& account_id) { |
72 return "picture_url-" + account_id; | 72 return "picture_url-" + account_id; |
73 } | 73 } |
74 | 74 |
75 void CheckAccountDetails(const std::string account_id, | 75 void CheckAccountDetails(const std::string& account_id, |
76 const AccountInfo& info) { | 76 const AccountInfo& info) { |
77 EXPECT_EQ(account_id, info.account_id); | 77 EXPECT_EQ(account_id, info.account_id); |
78 EXPECT_EQ(AccountIdToGaiaId(account_id), info.gaia); | 78 EXPECT_EQ(AccountIdToGaiaId(account_id), info.gaia); |
79 EXPECT_EQ(AccountIdToEmail(account_id), info.email); | 79 EXPECT_EQ(AccountIdToEmail(account_id), info.email); |
80 EXPECT_EQ(AccountTrackerService::kNoHostedDomainFound, | 80 EXPECT_EQ(AccountTrackerService::kNoHostedDomainFound, |
81 info.hosted_domain); | 81 info.hosted_domain); |
82 EXPECT_EQ(AccountIdToFullName(account_id), info.full_name); | 82 EXPECT_EQ(AccountIdToFullName(account_id), info.full_name); |
83 EXPECT_EQ(AccountIdToGivenName(account_id), info.given_name); | 83 EXPECT_EQ(AccountIdToGivenName(account_id), info.given_name); |
84 EXPECT_EQ(AccountIdToLocale(account_id), info.locale); | 84 EXPECT_EQ(AccountIdToLocale(account_id), info.locale); |
85 } | 85 } |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 ASSERT_FALSE(info.is_child_account); | 1164 ASSERT_FALSE(info.is_child_account); |
1165 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id))); | 1165 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id))); |
1166 | 1166 |
1167 SimulateTokenRevoked(child_id); | 1167 SimulateTokenRevoked(child_id); |
1168 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id))); | 1168 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id))); |
1169 | 1169 |
1170 tracker.RemoveObserver(&observer); | 1170 tracker.RemoveObserver(&observer); |
1171 fetcher.Shutdown(); | 1171 fetcher.Shutdown(); |
1172 tracker.Shutdown(); | 1172 tracker.Shutdown(); |
1173 } | 1173 } |
OLD | NEW |