From 308acc09bfaf6dabf4b6d5f5e39f33854df8ce34 Mon Sep 17 00:00:00 2001 From: rsgowman Date: Wed, 21 Mar 2018 11:04:40 -0400 Subject: Change CredentialsProvider::TokenListener to use StatusOr (#945) * Change CredentialsProvider::TokenListener to use StatusOr Rather than a token plus error code/msg. * Eliminate the concept of an invalid Token Instead, we'll just use StatusOr. Note that unauthenticated tokens are handled as a special case; they're created via: Token::Unauthenticated() and are otherwise "valid", though attempting to retrieve the raw token on one of these tokens will cause an assertion failure. --- .../firebase/firestore/auth/empty_credentials_provider_test.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Firestore/core/test/firebase/firestore/auth/empty_credentials_provider_test.cc') diff --git a/Firestore/core/test/firebase/firestore/auth/empty_credentials_provider_test.cc b/Firestore/core/test/firebase/firestore/auth/empty_credentials_provider_test.cc index 3b487f3..60845e5 100644 --- a/Firestore/core/test/firebase/firestore/auth/empty_credentials_provider_test.cc +++ b/Firestore/core/test/firebase/firestore/auth/empty_credentials_provider_test.cc @@ -16,6 +16,7 @@ #include "Firestore/core/src/firebase/firestore/auth/empty_credentials_provider.h" +#include "Firestore/core/src/firebase/firestore/util/statusor.h" #include "gtest/gtest.h" namespace firebase { @@ -25,14 +26,13 @@ namespace auth { TEST(EmptyCredentialsProvider, GetToken) { EmptyCredentialsProvider credentials_provider; credentials_provider.GetToken( - /*force_refresh=*/true, [](Token token, const int64_t error_code, - const absl::string_view error_msg) { - EXPECT_FALSE(token.is_valid()); + /*force_refresh=*/true, [](util::StatusOr result) { + EXPECT_TRUE(result.ok()); + const Token& token = result.ValueOrDie(); + EXPECT_ANY_THROW(token.token()); const User& user = token.user(); EXPECT_EQ("", user.uid()); EXPECT_FALSE(user.is_authenticated()); - EXPECT_EQ(FirestoreErrorCode::Ok, error_code); - EXPECT_EQ("", error_msg); }); } -- cgit v1.2.3