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 "chrome/browser/signin/signin_error_notifier_ash.h" | 5 #include "chrome/browser/signin/signin_error_notifier_ash.h" |
6 | 6 |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 TEST_F(SigninErrorNotifierTest, NoErrorAuthStatusProviders) { | 117 TEST_F(SigninErrorNotifierTest, NoErrorAuthStatusProviders) { |
118 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 118 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
119 { | 119 { |
120 // Add a provider (removes itself on exiting this scope). | 120 // Add a provider (removes itself on exiting this scope). |
121 FakeAuthStatusProvider provider(error_controller_); | 121 FakeAuthStatusProvider provider(error_controller_); |
122 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 122 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
123 } | 123 } |
124 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 124 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
125 } | 125 } |
126 | 126 |
| 127 #if !defined(OS_WIN) |
| 128 // Disabled on Win due to flake. http://crbug.com/372236 |
127 TEST_F(SigninErrorNotifierTest, ErrorAuthStatusProvider) { | 129 TEST_F(SigninErrorNotifierTest, ErrorAuthStatusProvider) { |
128 { | 130 { |
129 FakeAuthStatusProvider provider(error_controller_); | 131 FakeAuthStatusProvider provider(error_controller_); |
130 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 132 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
131 { | 133 { |
132 FakeAuthStatusProvider error_provider(error_controller_); | 134 FakeAuthStatusProvider error_provider(error_controller_); |
133 error_provider.SetAuthError(kTestAccountId, GoogleServiceAuthError( | 135 error_provider.SetAuthError(kTestAccountId, GoogleServiceAuthError( |
134 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); | 136 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); |
135 ASSERT_TRUE(notification_ui_manager_->FindById(kNotificationId)); | 137 ASSERT_TRUE(notification_ui_manager_->FindById(kNotificationId)); |
136 } | 138 } |
137 // error_provider is removed now that we've left that scope. | 139 // error_provider is removed now that we've left that scope. |
138 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 140 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
139 } | 141 } |
140 // All providers should be removed now. | 142 // All providers should be removed now. |
141 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 143 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
142 } | 144 } |
| 145 #endif |
143 | 146 |
144 TEST_F(SigninErrorNotifierTest, AuthStatusProviderErrorTransition) { | 147 TEST_F(SigninErrorNotifierTest, AuthStatusProviderErrorTransition) { |
145 { | 148 { |
146 FakeAuthStatusProvider provider0(error_controller_); | 149 FakeAuthStatusProvider provider0(error_controller_); |
147 FakeAuthStatusProvider provider1(error_controller_); | 150 FakeAuthStatusProvider provider1(error_controller_); |
148 provider0.SetAuthError( | 151 provider0.SetAuthError( |
149 kTestAccountId, | 152 kTestAccountId, |
150 GoogleServiceAuthError( | 153 GoogleServiceAuthError( |
151 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); | 154 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); |
152 ASSERT_TRUE(notification_ui_manager_->FindById(kNotificationId)); | 155 ASSERT_TRUE(notification_ui_manager_->FindById(kNotificationId)); |
(...skipping 17 matching lines...) Expand all Loading... |
170 ASSERT_FALSE(new_message.empty()); | 173 ASSERT_FALSE(new_message.empty()); |
171 | 174 |
172 ASSERT_NE(new_message, message); | 175 ASSERT_NE(new_message, message); |
173 | 176 |
174 provider1.SetAuthError( | 177 provider1.SetAuthError( |
175 kTestAccountId, GoogleServiceAuthError::AuthErrorNone()); | 178 kTestAccountId, GoogleServiceAuthError::AuthErrorNone()); |
176 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); | 179 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); |
177 } | 180 } |
178 } | 181 } |
179 | 182 |
| 183 #if !defined(OS_WIN) |
| 184 // Disabled on Win due to flake. http://crbug.com/372236 |
180 // Verify that SigninErrorNotifier ignores certain errors. | 185 // Verify that SigninErrorNotifier ignores certain errors. |
181 TEST_F(SigninErrorNotifierTest, AuthStatusEnumerateAllErrors) { | 186 TEST_F(SigninErrorNotifierTest, AuthStatusEnumerateAllErrors) { |
182 typedef struct { | 187 typedef struct { |
183 GoogleServiceAuthError::State error_state; | 188 GoogleServiceAuthError::State error_state; |
184 bool is_error; | 189 bool is_error; |
185 } ErrorTableEntry; | 190 } ErrorTableEntry; |
186 | 191 |
187 ErrorTableEntry table[] = { | 192 ErrorTableEntry table[] = { |
188 { GoogleServiceAuthError::NONE, false }, | 193 { GoogleServiceAuthError::NONE, false }, |
189 { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true }, | 194 { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, true }, |
(...skipping 19 matching lines...) Expand all Loading... |
209 const Notification* notification = notification_ui_manager_-> | 214 const Notification* notification = notification_ui_manager_-> |
210 FindById(kNotificationId); | 215 FindById(kNotificationId); |
211 ASSERT_EQ(table[i].is_error, notification != NULL); | 216 ASSERT_EQ(table[i].is_error, notification != NULL); |
212 if (table[i].is_error) { | 217 if (table[i].is_error) { |
213 EXPECT_FALSE(notification->title().empty()); | 218 EXPECT_FALSE(notification->title().empty()); |
214 EXPECT_FALSE(notification->message().empty()); | 219 EXPECT_FALSE(notification->message().empty()); |
215 EXPECT_EQ((size_t)1, notification->buttons().size()); | 220 EXPECT_EQ((size_t)1, notification->buttons().size()); |
216 } | 221 } |
217 } | 222 } |
218 } | 223 } |
| 224 #endif |
219 | 225 |
220 } // namespace test | 226 } // namespace test |
221 } // namespace ash | 227 } // namespace ash |
OLD | NEW |