chromium/components/optimization_guide/core/hints_fetcher_unittest.cc

// Copyright 2019 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/optimization_guide/core/hints_fetcher.h"

#include <memory>
#include <optional>

#include "base/command_line.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "components/optimization_guide/core/hints_processing_util.h"
#include "components/optimization_guide/core/optimization_guide_constants.h"
#include "components/optimization_guide/core/optimization_guide_enums.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_prefs.h"
#include "components/optimization_guide/core/optimization_guide_switches.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/prefs/testing_pref_service.h"
#include "components/variations/scoped_variations_ids_provider.h"
#include "net/base/url_util.h"
#include "net/http/http_request_headers.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/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace optimization_guide {

constexpr char optimization_guide_service_url[] =;

class HintsFetcherTest : public testing::Test,
                         public testing::WithParamInterface<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(HintsFetcherTest,
       FetchOptimizationGuideServiceHintsLogsHistogramUponExiting) {}

TEST_P(HintsFetcherTest, FetchOptimizationGuideServiceHints) {}

// Tests to ensure that multiple hint fetches by the same object cannot be in
// progress simultaneously.
TEST_P(HintsFetcherTest, FetchInProgress) {}

// Tests that the hints are refreshed again for hosts for whom hints were
// fetched recently.
TEST_P(HintsFetcherTest, FetchInProgress_HostsHintsRefreshed) {}

// Tests that the hints are refreshed again for hosts for whom hints were
// fetched recently.
TEST_P(HintsFetcherTest, FetchIgnoresCache) {}

// Tests 404 response from request.
TEST_P(HintsFetcherTest, FetchReturned404) {}

TEST_P(HintsFetcherTest, FetchReturnBadResponse) {}

TEST_P(HintsFetcherTest, HintsFetchSuccessfulHostsRecorded) {}

TEST_P(HintsFetcherTest, HintsFetchFailsHostNotRecorded) {}

TEST_P(HintsFetcherTest, HintsFetchClearHostsSuccessfullyFetched) {}

TEST_P(HintsFetcherTest, HintsFetchClearSingleFetchedHost) {}

TEST_P(HintsFetcherTest, HintsFetcherHostsCovered) {}

TEST_P(HintsFetcherTest, HintsFetcherCoveredHostExpired) {}

TEST_P(HintsFetcherTest, HintsFetcherHostNotCovered) {}

TEST_P(HintsFetcherTest, HintsFetcherRemoveExpiredOnSuccessfullyFetched) {}

TEST_P(HintsFetcherTest, HintsFetcherSuccessfullyFetchedHostsFull) {}

TEST_P(HintsFetcherTest, MaxHostsForOptimizationGuideServiceHintsFetch) {}

TEST_P(HintsFetcherTest, MaxUrlsForOptimizationGuideServiceHintsFetch) {}

TEST_P(HintsFetcherTest, OnlyURLsToFetch) {}

TEST_P(HintsFetcherTest, NoHostsOrURLsToFetch) {}

TEST_P(HintsFetcherTest, HintsLanguageOverrideHeader) {}

TEST_P(HintsFetcherTest, HintsLanguageOverrideDisabledByDefault) {}

}  // namespace optimization_guide