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/sync/sync_error_notifier_ash.h" | 5 #include "chrome/browser/sync/sync_error_notifier_ash.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 void VerifySyncErrorNotifierResult(GoogleServiceAuthError::State error_state, | 136 void VerifySyncErrorNotifierResult(GoogleServiceAuthError::State error_state, |
137 bool is_signed_in, | 137 bool is_signed_in, |
138 bool is_error) { | 138 bool is_error) { |
139 EXPECT_CALL(*service_, IsFirstSetupComplete()) | 139 EXPECT_CALL(*service_, IsFirstSetupComplete()) |
140 .WillRepeatedly(Return(is_signed_in)); | 140 .WillRepeatedly(Return(is_signed_in)); |
141 | 141 |
142 GoogleServiceAuthError auth_error(error_state); | 142 GoogleServiceAuthError auth_error(error_state); |
143 EXPECT_CALL(*service_, GetAuthError()).WillRepeatedly( | 143 EXPECT_CALL(*service_, GetAuthError()).WillRepeatedly( |
144 ReturnRef(auth_error)); | 144 ReturnRef(auth_error)); |
145 | 145 |
146 error_controller_->OnStateChanged(); | 146 error_controller_->OnStateChanged(service_.get()); |
147 EXPECT_EQ(is_error, error_controller_->HasError()); | 147 EXPECT_EQ(is_error, error_controller_->HasError()); |
148 | 148 |
149 // If there is an error we should see a notification. | 149 // If there is an error we should see a notification. |
150 const Notification* notification = notification_ui_manager_->FindById( | 150 const Notification* notification = notification_ui_manager_->FindById( |
151 kNotificationId, NotificationUIManager::GetProfileID(profile_)); | 151 kNotificationId, NotificationUIManager::GetProfileID(profile_)); |
152 if (is_error) { | 152 if (is_error) { |
153 ASSERT_TRUE(notification); | 153 ASSERT_TRUE(notification); |
154 ASSERT_FALSE(notification->title().empty()); | 154 ASSERT_FALSE(notification->title().empty()); |
155 ASSERT_FALSE(notification->title().empty()); | 155 ASSERT_FALSE(notification->title().empty()); |
156 ASSERT_EQ((size_t)1, notification->buttons().size()); | 156 ASSERT_EQ((size_t)1, notification->buttons().size()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); | 228 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); |
229 VerifySyncErrorNotifierResult( | 229 VerifySyncErrorNotifierResult( |
230 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 230 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
231 false /* not signed in */, | 231 false /* not signed in */, |
232 false /* no error */); | 232 false /* no error */); |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 } // namespace test | 236 } // namespace test |
237 } // namespace ash | 237 } // namespace ash |
OLD | NEW |