#include "remoting/base/oauth_token_getter_proxy.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "base/threading/thread_checker.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
namespace {
OAuthTokenGetter::TokenCallback GetDoNothingTokenCallback() { … }
class FakeOAuthTokenGetter : public OAuthTokenGetter { … };
FakeOAuthTokenGetter::FakeOAuthTokenGetter() { … }
FakeOAuthTokenGetter::~FakeOAuthTokenGetter() { … }
void FakeOAuthTokenGetter::ResolveCallback(Status status,
const std::string& user_email,
const std::string& access_token) { … }
void FakeOAuthTokenGetter::ExpectInvalidateCache() { … }
void FakeOAuthTokenGetter::CallWithToken(TokenCallback on_access_token) { … }
void FakeOAuthTokenGetter::InvalidateCache() { … }
base::WeakPtr<FakeOAuthTokenGetter> FakeOAuthTokenGetter::GetWeakPtr() { … }
}
class OAuthTokenGetterProxyTest : public testing::Test { … };
void OAuthTokenGetterProxyTest::SetUp() { … }
void OAuthTokenGetterProxyTest::TearDown() { … }
void OAuthTokenGetterProxyTest::TestCallWithTokenOnRunnerThread(
OAuthTokenGetter::Status status,
const std::string& user_email,
const std::string& access_token) { … }
void OAuthTokenGetterProxyTest::TestCallWithTokenOnMainThread(
OAuthTokenGetter::Status status,
const std::string& user_email,
const std::string& access_token) { … }
void OAuthTokenGetterProxyTest::ExpectInvalidateCache() { … }
void OAuthTokenGetterProxyTest::InvalidateTokenGetter() { … }
void OAuthTokenGetterProxyTest::TestCallWithTokenImpl(
OAuthTokenGetter::Status status,
const std::string& user_email,
const std::string& access_token) { … }
void OAuthTokenGetterProxyTest::OnTokenReceived(
OAuthTokenGetter::Status status,
const std::string& user_email,
const std::string& access_token) { … }
TEST_F(OAuthTokenGetterProxyTest, CallWithTokenOnMainThread) { … }
TEST_F(OAuthTokenGetterProxyTest, CallWithTokenOnRunnerThread) { … }
TEST_F(OAuthTokenGetterProxyTest, InvalidateCacheOnMainThread) { … }
TEST_F(OAuthTokenGetterProxyTest, InvalidateCacheOnRunnerThread) { … }
TEST_F(
OAuthTokenGetterProxyTest,
CallWithTokenOnMainThreadAfterTokenGetterDestroyed_callsSilentlyDropped) { … }
TEST_F(
OAuthTokenGetterProxyTest,
CallWithTokenOnRunnerThreadAfterTokenGetterDestroyed_callsSilentlyDropped) { … }
TEST_F(
OAuthTokenGetterProxyTest,
InvalidateCacheOnMainThreadAfterTokenGetterDestroyed_callsSilentlyDropped) { … }
TEST_F(
OAuthTokenGetterProxyTest,
InvalidateCacheOnRunnerThreadAfterTokenGetterDestroyed_callsSilentlyDropped) { … }
}