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

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

Issue 2314913003: Deprecate HOSTED_NOT_ALLOWED auth error (Closed)
Patch Set: Fix unit test 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, true },
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 (table[i].error_state ==
155 GoogleServiceAuthError::HOSTED_NOT_ALLOWED_DEPRECATED)
156 continue;
Greg Levin 2016/09/08 19:56:35 I couldn't remove HOSTED_NOT_ALLOWED from this tab
Roger Tawa OOO till Jul 10th 2016/09/08 21:05:58 Got it, I see what you mean. I guess the problem
154 base::HistogramTester histogram_tester; 157 base::HistogramTester histogram_tester;
155 FakeAuthStatusProvider provider(error_controller()); 158 FakeAuthStatusProvider provider(error_controller());
156 provider.SetAuthError(kTestAccountId, 159 provider.SetAuthError(kTestAccountId,
157 GoogleServiceAuthError(table[i].error_state)); 160 GoogleServiceAuthError(table[i].error_state));
158 161
159 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error); 162 EXPECT_EQ(global_error()->HasMenuItem(), table[i].is_error);
160 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error); 163 EXPECT_EQ(global_error()->MenuItemLabel().empty(), !table[i].is_error);
161 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(), 164 EXPECT_EQ(global_error()->GetBubbleViewMessages().empty(),
162 !table[i].is_error); 165 !table[i].is_error);
163 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty()); 166 EXPECT_FALSE(global_error()->GetBubbleViewTitle().empty());
164 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty()); 167 EXPECT_FALSE(global_error()->GetBubbleViewAcceptButtonLabel().empty());
165 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty()); 168 EXPECT_TRUE(global_error()->GetBubbleViewCancelButtonLabel().empty());
166 169
167 ProfileMetrics::LogNumberOfProfiles( 170 ProfileMetrics::LogNumberOfProfiles(
168 testing_profile_manager()->profile_manager()); 171 testing_profile_manager()->profile_manager());
169 172
170 if (table[i].is_error) 173 if (table[i].is_error)
171 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1); 174 histogram_tester.ExpectBucketCount("Signin.AuthError", i, 1);
172 histogram_tester.ExpectBucketCount( 175 histogram_tester.ExpectBucketCount(
173 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1); 176 "Profile.NumberOfProfilesWithAuthErrors", table[i].is_error, 1);
174 } 177 }
175 } 178 }
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