#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/policy/core/common/cloud/external_policy_data_fetcher.h"
#include <stdint.h>
#include <utility>
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/task_environment.h"
#include "base/test/test_simple_task_runner.h"
#include "net/base/net_errors.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/gtest/include/gtest/gtest.h"
namespace policy {
namespace {
const char* kExternalPolicyDataURLs[] = …;
const int64_t kExternalPolicyDataMaxSize = …;
const char* kExternalPolicyDataPayload = …;
const char* kExternalPolicyDataOverflowPayload = …;
}
class ExternalPolicyDataFetcherTest : public testing::Test { … };
ExternalPolicyDataFetcherTest::ExternalPolicyDataFetcherTest()
: … { … }
ExternalPolicyDataFetcherTest::~ExternalPolicyDataFetcherTest() { … }
void ExternalPolicyDataFetcherTest::SetUp() { … }
void ExternalPolicyDataFetcherTest::StartJob(int index) { … }
void ExternalPolicyDataFetcherTest::CancelJob(int index) { … }
void ExternalPolicyDataFetcherTest::OnJobFinished(
int job_index,
ExternalPolicyDataFetcher::Result result,
std::unique_ptr<std::string> data) { … }
int ExternalPolicyDataFetcherTest::GetAndResetCallbackCount() { … }
TEST_F(ExternalPolicyDataFetcherTest, Success) { … }
TEST_F(ExternalPolicyDataFetcherTest, MaxSizeExceeded) { … }
TEST_F(ExternalPolicyDataFetcherTest, ConnectionInterrupted) { … }
TEST_F(ExternalPolicyDataFetcherTest, NetworkError) { … }
TEST_F(ExternalPolicyDataFetcherTest, ServerError) { … }
TEST_F(ExternalPolicyDataFetcherTest, ClientError) { … }
TEST_F(ExternalPolicyDataFetcherTest, HTTPError) { … }
TEST_F(ExternalPolicyDataFetcherTest, Canceled) { … }
TEST_F(ExternalPolicyDataFetcherTest, SuccessfulCanceled) { … }
TEST_F(ExternalPolicyDataFetcherTest, ParallelJobs) { … }
TEST_F(ExternalPolicyDataFetcherTest, ParallelJobsFinishingOutOfOrder) { … }
TEST_F(ExternalPolicyDataFetcherTest, ParallelJobsWithCancel) { … }
}