chromium/components/sync/engine/net/http_bridge_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/sync/engine/net/http_bridge.h"

#include <stddef.h>

#include <utility>

#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "components/variations/scoped_variations_ids_provider.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/network/test/test_shared_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/zlib/google/compression_utils.h"

namespace syncer {

namespace {

HasSubstr;

// TODO(timsteele): Should use PathService here. See Chromium Issue 3113.
const base::FilePath::CharType kDocRoot[] =);

}  // namespace

const char kUserAgent[] =;

#if BUILDFLAG(IS_ANDROID)
#define MAYBE_SyncHttpBridgeTest
#else
#define MAYBE_SyncHttpBridgeTest
#endif  // BUILDFLAG(IS_ANDROID)
class MAYBE_SyncHttpBridgeTest : public testing::Test {};

// An HttpBridge that doesn't actually make network requests and just calls
// back with fake response info.
// TODO(tim): Instead of inheriting here we should inject a component
// responsible for the MakeAsynchronousPost bit.
class ShuntedHttpBridge : public HttpBridge {};

void MAYBE_SyncHttpBridgeTest::RunSyncThreadBridgeUseTest(
    base::WaitableEvent* signal_when_created,
    base::WaitableEvent* signal_when_released) {}

// Test the HttpBridge without actually making any network requests.
TEST_F(MAYBE_SyncHttpBridgeTest, TestMakeSynchronousPostShunted) {}

// Full round-trip test of the HttpBridge with compressed data, check if the
// data is correctly compressed.
TEST_F(MAYBE_SyncHttpBridgeTest, CompressedRequestPayloadCheck) {}

// Full round-trip test of the HttpBridge with compression, check if header
// fields("Content-Encoding" ,"Accept-Encoding" and user agent) are set
// correctly.
TEST_F(MAYBE_SyncHttpBridgeTest, CompressedRequestHeaderCheck) {}

TEST_F(MAYBE_SyncHttpBridgeTest, TestExtraRequestHeaders) {}

TEST_F(MAYBE_SyncHttpBridgeTest, TestResponseHeader) {}

TEST_F(MAYBE_SyncHttpBridgeTest, HttpErrors) {}

TEST_F(MAYBE_SyncHttpBridgeTest, NetErrorUnreached) {}

TEST_F(MAYBE_SyncHttpBridgeTest, Abort) {}

TEST_F(MAYBE_SyncHttpBridgeTest, AbortLate) {}

// Tests an interesting case where code using the HttpBridge aborts the fetch
// and releases ownership before a pending fetch completed callback is issued by
// the underlying URLFetcher (and before that URLFetcher is destroyed, which
// would cancel the callback).
TEST_F(MAYBE_SyncHttpBridgeTest, AbortAndReleaseBeforeFetchComplete) {}

}  // namespace syncer