#include "components/endpoint_fetcher/endpoint_fetcher.h"
#include <string>
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/version_info/channel.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "net/http/http_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
MockEndpointFetcherCallback;
namespace {
const char kContentType[] = …;
const char kEmail[] = …;
const char kEndpoint[] = …;
const char kEmptyResponse[] = …;
const char kExpectedResponse[] = …;
const char kExpectedAuthError[] = …;
const char kExpectedResponseError[] = …;
const char kExpectedPrimaryAccountError[] = …;
const char kExpectedSanitizationError[] = …;
const char kHttpPostMethod[] = …;
const char kMalformedResponse[] = …;
const char kJsonMimeType[] = …;
const char kMockPostData[] = …;
constexpr base::TimeDelta kMockTimeout = …;
const char kOAuthConsumerName[] = …;
const char kScope[] = …;
const char kApiKey[] = …;
}
Field;
Pointee;
class EndpointFetcherTest : public testing::Test { … };
TEST_F(EndpointFetcherTest, FetchResponse) { … }
TEST_F(EndpointFetcherTest, FetchMalformedResponse) { … }
TEST_F(EndpointFetcherTest, FetchEndpointResponseError) { … }
TEST_F(EndpointFetcherTest, FetchRedirectionResponse) { … }
TEST_F(EndpointFetcherTest, FetchOAuthError) { … }
TEST_F(EndpointFetcherTest, FetchOAuthNoPrimaryAccount) { … }
TEST_F(EndpointFetcherTest, PerformRequestAuthError) { … }
TEST_F(EndpointFetcherTest, FetchNonJsonResponse) { … }
TEST_F(EndpointFetcherTest, TestCredentialsModeUnspecified) { … }
TEST_F(EndpointFetcherTest, TestOmitCredentialsMode) { … }
TEST_F(EndpointFetcherTest, TestIncludeCredentialsMode) { … }
TEST_F(EndpointFetcherTest, TestMaxRetriesUnspecified) { … }
TEST_F(EndpointFetcherTest, TestMaxRetries) { … }