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 "components/signin/core/browser/signin_error_controller.h" | 5 #include "components/signin/core/browser/signin_error_controller.h" |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/signin/core/browser/fake_auth_status_provider.h" | 10 #include "components/signin/core/browser/fake_auth_status_provider.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, | 157 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, |
158 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, | 158 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, |
159 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, | 159 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, |
160 { GoogleServiceAuthError::TWO_FACTOR, true }, | 160 { GoogleServiceAuthError::TWO_FACTOR, true }, |
161 { GoogleServiceAuthError::REQUEST_CANCELED, true }, | 161 { GoogleServiceAuthError::REQUEST_CANCELED, true }, |
162 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, | 162 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, |
163 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, | 163 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, |
164 { GoogleServiceAuthError::SERVICE_ERROR, true }, | 164 { GoogleServiceAuthError::SERVICE_ERROR, true }, |
165 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, | 165 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, |
166 }; | 166 }; |
167 COMPILE_ASSERT(arraysize(table) == GoogleServiceAuthError::NUM_STATES, | 167 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES, |
168 kTable_size_does_not_match_number_of_auth_error_types); | 168 "table array does not match the number of auth error types"); |
169 | 169 |
170 for (size_t i = 0; i < arraysize(table); ++i) { | 170 for (size_t i = 0; i < arraysize(table); ++i) { |
171 FakeAuthStatusProvider provider(error_controller_.get()); | 171 FakeAuthStatusProvider provider(error_controller_.get()); |
172 provider.SetAuthError(kTestAccountId, | 172 provider.SetAuthError(kTestAccountId, |
173 kTestUsername, | 173 kTestUsername, |
174 GoogleServiceAuthError(table[i].error_state)); | 174 GoogleServiceAuthError(table[i].error_state)); |
175 | 175 |
176 EXPECT_EQ(error_controller_->HasError(), table[i].is_error); | 176 EXPECT_EQ(error_controller_->HasError(), table[i].is_error); |
177 | 177 |
178 if (table[i].is_error) { | 178 if (table[i].is_error) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 GoogleServiceAuthError::NONE)); | 263 GoogleServiceAuthError::NONE)); |
264 ASSERT_EQ(GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, | 264 ASSERT_EQ(GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, |
265 error_controller_->auth_error().state()); | 265 error_controller_->auth_error().state()); |
266 ASSERT_STREQ(kTestAccountId, | 266 ASSERT_STREQ(kTestAccountId, |
267 error_controller_->error_account_id().c_str()); | 267 error_controller_->error_account_id().c_str()); |
268 | 268 |
269 fake_provider0.reset(); | 269 fake_provider0.reset(); |
270 fake_provider1.reset(); | 270 fake_provider1.reset(); |
271 ASSERT_FALSE(error_controller_->HasError()); | 271 ASSERT_FALSE(error_controller_->HasError()); |
272 } | 272 } |
OLD | NEW |