Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9166)

Unified Diff: blimp/client/core/session/identity_source_unittest.cc

Issue 2391263005: Propagate error messages to UI for blimp. (Closed)
Patch Set: Minor fixes. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/client/core/session/identity_source.cc ('k') | blimp/client/public/blimp_client_context_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/session/identity_source_unittest.cc
diff --git a/blimp/client/core/session/identity_source_unittest.cc b/blimp/client/core/session/identity_source_unittest.cc
index 06db6e9ec1106d60efb50af91a0f753a105be247..463a2fa2994003453e66ae4dec217865b690dde9 100644
--- a/blimp/client/core/session/identity_source_unittest.cc
+++ b/blimp/client/core/session/identity_source_unittest.cc
@@ -14,6 +14,9 @@
#include "blimp/client/test/test_blimp_client_context_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
+using ::testing::_;
+using ::testing::Return;
+
namespace blimp {
namespace client {
namespace {
@@ -221,6 +224,36 @@ TEST_F(IdentitySourceTest, TestConnectRetry) {
DCHECK_EQ(auth.CallbackToken(), mock_access_token);
}
+TEST_F(IdentitySourceTest, TestConnectFailDelegateCallback) {
+ TestBlimpClientContextDelegate mock_blimp_delegate;
+ MockIdentitySource auth(
+ &mock_blimp_delegate,
+ base::Bind(&MockIdentitySource::MockTokenCall, base::Unretained(&auth)));
+ FakeOAuth2TokenService* token_service = mock_blimp_delegate.GetTokenService();
+ FakeIdentityProvider* id_provider =
+ static_cast<FakeIdentityProvider*>(auth.GetIdentityProvider());
+
+ std::string account = "mock_account";
+ std::string mock_access_token = "mock_token";
+ id_provider->LogIn(account);
+
+ // Prepare refresh token.
+ FakeOAuth2TokenServiceDelegate* mock_token_service_delegate =
+ token_service->GetFakeOAuth2TokenServiceDelegate();
+ mock_token_service_delegate->UpdateCredentials(account, "mock_refresh_token");
+
+ // Expect delegate to show error message on non REQUEST_CANCELED errors.
+ auth.Connect();
+ GoogleServiceAuthError error(
+ GoogleServiceAuthError::State::CONNECTION_FAILED);
+
+ EXPECT_CALL(mock_blimp_delegate, OnAuthenticationError(error))
+ .WillOnce(Return());
+ token_service->IssueErrorForAllPendingRequestsForAccount(account, error);
+
+ DCHECK_EQ(auth.Failed(), 1);
+}
+
} // namespace
} // namespace client
} // namespace blimp
« no previous file with comments | « blimp/client/core/session/identity_source.cc ('k') | blimp/client/public/blimp_client_context_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698