OLD | NEW |
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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, | 103 { GoogleServiceAuthError::ACCOUNT_DELETED, true }, |
104 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, | 104 { GoogleServiceAuthError::ACCOUNT_DISABLED, true }, |
105 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, | 105 { GoogleServiceAuthError::SERVICE_UNAVAILABLE, true }, |
106 { GoogleServiceAuthError::TWO_FACTOR, true }, | 106 { GoogleServiceAuthError::TWO_FACTOR, true }, |
107 { GoogleServiceAuthError::REQUEST_CANCELED, true }, | 107 { GoogleServiceAuthError::REQUEST_CANCELED, true }, |
108 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, | 108 { GoogleServiceAuthError::HOSTED_NOT_ALLOWED, true }, |
109 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, | 109 { GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE, true }, |
110 { GoogleServiceAuthError::SERVICE_ERROR, true }, | 110 { GoogleServiceAuthError::SERVICE_ERROR, true }, |
111 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, | 111 { GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true }, |
112 }; | 112 }; |
113 COMPILE_ASSERT(arraysize(table) == GoogleServiceAuthError::NUM_STATES, | 113 static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES, |
114 kTable_size_does_not_match_number_of_auth_error_types); | 114 "table size should match number of auth error types"); |
115 | 115 |
116 for (size_t i = 0; i < arraysize(table); ++i) { | 116 for (size_t i = 0; i < arraysize(table); ++i) { |
117 FakeAuthStatusProvider provider(error_controller_); | 117 FakeAuthStatusProvider provider(error_controller_); |
118 provider.SetAuthError(kTestAccountId, | 118 provider.SetAuthError(kTestAccountId, |
119 kTestUsername, | 119 kTestUsername, |
120 GoogleServiceAuthError(table[i].error_state)); | 120 GoogleServiceAuthError(table[i].error_state)); |
121 | 121 |
122 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); | 122 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); |
123 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); | 123 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); |
124 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), | 124 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), |
125 !table[i].is_error); | 125 !table[i].is_error); |
126 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); | 126 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); |
127 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); | 127 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); |
128 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); | 128 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); |
129 } | 129 } |
130 } | 130 } |
OLD | NEW |