OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_global_error.h" | 5 #include "chrome/browser/sync/sync_global_error.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 SyncGlobalError* global_error, | 85 SyncGlobalError* global_error, |
86 GoogleServiceAuthError::State error_state, | 86 GoogleServiceAuthError::State error_state, |
87 bool is_signed_in, | 87 bool is_signed_in, |
88 bool is_error) { | 88 bool is_error) { |
89 EXPECT_CALL(*service, IsFirstSetupComplete()) | 89 EXPECT_CALL(*service, IsFirstSetupComplete()) |
90 .WillRepeatedly(Return(is_signed_in)); | 90 .WillRepeatedly(Return(is_signed_in)); |
91 | 91 |
92 GoogleServiceAuthError auth_error(error_state); | 92 GoogleServiceAuthError auth_error(error_state); |
93 EXPECT_CALL(*service, GetAuthError()).WillRepeatedly(ReturnRef(auth_error)); | 93 EXPECT_CALL(*service, GetAuthError()).WillRepeatedly(ReturnRef(auth_error)); |
94 | 94 |
95 error->OnStateChanged(); | 95 error->OnStateChanged(service); |
96 EXPECT_EQ(is_error, error->HasError()); | 96 EXPECT_EQ(is_error, error->HasError()); |
97 | 97 |
98 // If there is an error then a menu item and bubble view should be shown. | 98 // If there is an error then a menu item and bubble view should be shown. |
99 EXPECT_EQ(is_error, global_error->HasMenuItem()); | 99 EXPECT_EQ(is_error, global_error->HasMenuItem()); |
100 EXPECT_EQ(is_error, global_error->HasBubbleView()); | 100 EXPECT_EQ(is_error, global_error->HasBubbleView()); |
101 | 101 |
102 // If there is an error then labels should not be empty. | 102 // If there is an error then labels should not be empty. |
103 EXPECT_NE(0, global_error->MenuItemCommandID()); | 103 EXPECT_NE(0, global_error->MenuItemCommandID()); |
104 EXPECT_NE(is_error, global_error->MenuItemLabel().empty()); | 104 EXPECT_NE(is_error, global_error->MenuItemLabel().empty()); |
105 EXPECT_NE(is_error, global_error->GetBubbleViewAcceptButtonLabel().empty()); | 105 EXPECT_NE(is_error, global_error->GetBubbleViewAcceptButtonLabel().empty()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 .WillRepeatedly(Return(true)); | 169 .WillRepeatedly(Return(true)); |
170 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) | 170 EXPECT_CALL(service, IsPassphraseRequiredForDecryption()) |
171 .WillRepeatedly(Return(true)); | 171 .WillRepeatedly(Return(true)); |
172 VerifySyncGlobalErrorResult( | 172 VerifySyncGlobalErrorResult( |
173 &service, login_ui_service, browser(), &error, &global_error, | 173 &service, login_ui_service, browser(), &error, &global_error, |
174 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 174 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
175 false /* not signed in */, false /* no error */); | 175 false /* not signed in */, false /* no error */); |
176 | 176 |
177 global_error.Shutdown(); | 177 global_error.Shutdown(); |
178 } | 178 } |
OLD | NEW |