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

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

Issue 2314913003: Deprecate HOSTED_NOT_ALLOWED auth error (Closed)
Patch Set: Replace NUM_DEPRECATED_STATES with IsDeprecated() 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 }, 142 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED_DEPRECATED, false },
143 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, 143 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true },
144 { GoogleServiceAuthError::SERVICE_ERROR, true }, 144 { GoogleServiceAuthError::SERVICE_ERROR, true },
145 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, 145 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true },
146 }; 146 };
147 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES, 147 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES,
148 "table size should match number of auth error types"); 148 "table size should match number of auth error types");
149 149
150 // Mark the profile with an active timestamp so profile_metrics logs it. 150 // Mark the profile with an active timestamp so profile_metrics logs it.
151 testing_profile_manager()->UpdateLastUser(profile()); 151 testing_profile_manager()->UpdateLastUser(profile());
152 152
153 for (size_t i = 0; i < arraysize(table); ++i) { 153 for (size_t i = 0; i < arraysize(table); ++i) {
154 if (GoogleServiceAuthError::IsDeprecated(table[i].error_state))
155 continue;
154 base::HistogramTester histogram_tester; 156 base::HistogramTester histogram_tester;
155 FakeAuthStatusProvider provider(error_controller()); 157 FakeAuthStatusProvider provider(error_controller());
156 provider.SetAuthError(kTestAccountId, 158 provider.SetAuthError(kTestAccountId,
157 GoogleServiceAuthError(table[i].error_state)); 159 GoogleServiceAuthError(table[i].error_state));
158 160
159 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error); 161 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error);
160 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error); 162 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error);
161 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(), 163 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(),
162 !table[i].is_error); 164 !table[i].is_error);
163 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty()); 165 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty());
164 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty()); 166 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty());
165 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty()); 167 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty());
166 168
167 ProfileMetrics::LogNumberOfProfiles( 169 ProfileMetrics::LogNumberOfProfiles(
168 testing_profile_manager()->profile_manager()); 170 testing_profile_manager()->profile_manager());
169 171
170 if (table[i].is_error) 172 if (table[i].is_error)
171 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1); 173 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1);
172 histogram_tester.ExpectBucketCount( 174 histogram_tester.ExpectBucketCount(
173 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1); 175 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1);
174 } 176 }
175 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_error_notifier_ash_unittest.cc ('k') | chrome/browser/sync/sync_ui_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698