Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/signin/signin_global_error_unittest.cc

Issue 2314913003: Deprecate HOSTED_NOT_ALLOWED auth error (Closed)
Patch Set: Add DEPRECATED count, remove HOSTED from all unit tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/signin/signin_global_error.h" 5 #include "chrome/browser/signin/signin_global_error.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 { GoogleServiceAuthError::NONE, false }, 132 { GoogleServiceAuthError::NONE, false },
133 { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true }, 133 { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true },
134 { GoogleServiceAuthError::USER_NOT_SIGNED_UP, true }, 134 { GoogleServiceAuthError::USER_NOT_SIGNED_UP, true },
135 { GoogleServiceAuthError::CONNECTION_FAILED, false }, 135 { GoogleServiceAuthError::CONNECTION_FAILED, false },
136 { GoogleServiceAuthError::CAPTCHA_REQUIRED, true }, 136 { GoogleServiceAuthError::CAPTCHA_REQUIRED, true },
137 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, 137 { GoogleServiceAuthError::ACCOUNT_DELETED, true },
138 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, 138 { GoogleServiceAuthError::ACCOUNT_DISABLED, true },
139 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, 139 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true },
140 { GoogleServiceAuthError::TWO_FACTOR, true }, 140 { GoogleServiceAuthError::TWO_FACTOR, true },
141 { GoogleServiceAuthError::REQUEST_CANCELED, true }, 141 { GoogleServiceAuthError::REQUEST_CANCELED, true },
142 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true },
143 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, 142 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true },
144 { GoogleServiceAuthError::SERVICE_ERROR, true }, 143 { GoogleServiceAuthError::SERVICE_ERROR, true },
145 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, 144 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true },
146 }; 145 };
147 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES, 146 static_assert(arraysize(table) ==
148 "table size should match number of auth error types"); 147 GoogleServiceAuthError::NUM_STATES -
148 GoogleServiceAuthError::NUM_DEPRECATED_STATES,
149 "table size should match number of auth error types");
149 150
150 // Mark the profile with an active timestamp so profile_metrics logs it. 151 // Mark the profile with an active timestamp so profile_metrics logs it.
151 testing_profile_manager()->UpdateLastUser(profile()); 152 testing_profile_manager()->UpdateLastUser(profile());
152 153
153 for (size_t i = 0; i < arraysize(table); ++i) { 154 for (size_t i = 0; i < arraysize(table); ++i) {
154 base::HistogramTester histogram_tester; 155 base::HistogramTester histogram_tester;
155 FakeAuthStatusProvider provider(error_controller()); 156 FakeAuthStatusProvider provider(error_controller());
156 provider.SetAuthError(kTestAccountId, 157 provider.SetAuthError(kTestAccountId,
157 GoogleServiceAuthError(table[i].error_state)); 158 GoogleServiceAuthError(table[i].error_state));
158 159
159 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error); 160 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error);
160 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error); 161 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error);
161 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(), 162 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(),
162 !table[i].is_error); 163 !table[i].is_error);
163 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty()); 164 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty());
164 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty()); 165 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty());
165 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty()); 166 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty());
166 167
167 ProfileMetrics::LogNumberOfProfiles( 168 ProfileMetrics::LogNumberOfProfiles(
168 testing_profile_manager()->profile_manager()); 169 testing_profile_manager()->profile_manager());
169 170
170 if (table[i].is_error) 171 if (table[i].is_error)
171 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1); 172 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1);
172 histogram_tester.ExpectBucketCount( 173 histogram_tester.ExpectBucketCount(
173 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1); 174 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1);
174 } 175 }
175 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698