chromium/components/network_time/network_time_tracker_unittest.cc

// Copyright 2014 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/network_time/network_time_tracker.h"

#include <memory>
#include <string>
#include <string_view>
#include <utility>

#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/simple_test_clock.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/client_update_protocol/ecdsa.h"
#include "components/network_time/network_time_pref_names.h"
#include "components/network_time/network_time_test_utils.h"
#include "components/prefs/testing_pref_service.h"
#include "net/http/http_response_headers.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_response.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/url_loader_completion_status.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_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace network_time {

namespace {

struct MockedResponse {};

}  // namespace

class NetworkTimeTrackerTest : public ::testing::Test {};

TEST_F(NetworkTimeTrackerTest, Uninitialized) {}

TEST_F(NetworkTimeTrackerTest, LongPostingDelay) {}

TEST_F(NetworkTimeTrackerTest, LopsidedLatency) {}

TEST_F(NetworkTimeTrackerTest, ClockIsWack) {}

TEST_F(NetworkTimeTrackerTest, ClocksDivergeSlightly) {}

TEST_F(NetworkTimeTrackerTest, NetworkTimeUpdates) {}

TEST_F(NetworkTimeTrackerTest, SpringForward) {}

TEST_F(NetworkTimeTrackerTest, TickClockSpringsForward) {}

TEST_F(NetworkTimeTrackerTest, FallBack) {}

TEST_F(NetworkTimeTrackerTest, SuspendAndResume) {}

TEST_F(NetworkTimeTrackerTest, Serialize) {}

TEST_F(NetworkTimeTrackerTest, DeserializeOldFormat) {}

TEST_F(NetworkTimeTrackerTest, SerializeWithLongDelay) {}

TEST_F(NetworkTimeTrackerTest, SerializeWithTickClockAdvance) {}

TEST_F(NetworkTimeTrackerTest, SerializeWithWallClockAdvance) {}

TEST_F(NetworkTimeTrackerTest, UpdateFromNetwork) {}

TEST_F(NetworkTimeTrackerTest, StartTimeFetch) {}

// Tests that when StartTimeFetch() is called with a query already in
// progress, it calls the callback when that query completes.
TEST_F(NetworkTimeTrackerTest, StartTimeFetchWithQueryInProgress) {}

// Tests that StartTimeFetch() returns false if called while network
// time is available.
TEST_F(NetworkTimeTrackerTest, StartTimeFetchWhileSynced) {}

// Tests that StartTimeFetch() returns false if the field trial
// is not configured to allow on-demand time fetches.
TEST_F(NetworkTimeTrackerTest, StartTimeFetchWithoutVariationsParam) {}

TEST_F(NetworkTimeTrackerTest, NoNetworkQueryWhileSynced) {}

TEST_F(NetworkTimeTrackerTest, NoNetworkQueryWhileFeatureDisabled) {}

TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkBadSignature) {}

static const uint8_t kDevKeyPubBytes[] =;

TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkBadData) {}

TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkServerError) {}

#if BUILDFLAG(IS_IOS)
// http://crbug.com/658619
#define MAYBE_UpdateFromNetworkNetworkError
#else
#define MAYBE_UpdateFromNetworkNetworkError
#endif
TEST_F(NetworkTimeTrackerTest, MAYBE_UpdateFromNetworkNetworkError) {}

TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkLargeResponse) {}

TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkFirstSyncPending) {}

TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkSubseqeuntSyncPending) {}

TEST_F(NetworkTimeTrackerTest, CustomFetchBehaviorTest) {}

TEST_F(NetworkTimeTrackerTest, ObserverTest) {}

}  // namespace network_time