chromium/net/http/broken_alternative_services_unittest.cc

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

#include "net/http/broken_alternative_services.h"

#include <algorithm>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/schemeful_site.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace net {

namespace {

// Initial delay for broken alternative services.
const uint64_t kBrokenAlternativeProtocolDelaySecs =;

class BrokenAlternativeServicesTest
    : public BrokenAlternativeServices::Delegate,
      public ::testing::Test {};

TEST_F(BrokenAlternativeServicesTest, MarkBroken) {}

TEST_F(BrokenAlternativeServicesTest, MarkBrokenUntilDefaultNetworkChanges) {}

TEST_F(BrokenAlternativeServicesTest, MarkRecentlyBroken) {}

TEST_F(BrokenAlternativeServicesTest, OnDefaultNetworkChanged) {}

TEST_F(BrokenAlternativeServicesTest,
       ExpireBrokenAlternativeServiceOnDefaultNetwork) {}

TEST_F(BrokenAlternativeServicesTest, ExpireBrokenAlternateProtocolMappings) {}

TEST_F(BrokenAlternativeServicesTest, IsBroken) {}

// This test verifies that exponential backoff is applied to the expiration of
// broken alternative service regardless of which MarkBroken method was used.
// In particular, the alternative service's brokenness state is as follows:
// - marked broken on the default network;
// - brokenness expires after one delay;
// - marked broken;
// - (signal received that default network changes);
// - brokenness expires after two intervals.
TEST_F(BrokenAlternativeServicesTest, BrokenAfterBrokenOnDefaultNetwork) {}

// This test verifies that exponentail backoff is applied to the expiration of
// broken alternative service regardless of which MarkBroken method was used.
// In particular, the alternative service's brokenness state is as follows:
// - marked broken;
// - brokenness expires after one delay;
// - marked broken on the default network;
// - broknenss expires after two intervals;
// - (signal received that default network changes);
TEST_F(BrokenAlternativeServicesTest, BrokenOnDefaultNetworkAfterBroken) {}

// This test verifies that exponentail backoff is applied to expire alternative
// service that's marked broken until the default network changes. When default
// network changes, the exponential backoff is cleared.
TEST_F(BrokenAlternativeServicesTest,
       BrokenUntilDefaultNetworkChangeWithExponentialBackoff) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff) {}

void BrokenAlternativeServicesTest::TestExponentialBackoff(
    base::TimeDelta initial_delay,
    bool exponential_backoff_on_initial_delay) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_OneSecond_True) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_OneSecond_False) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_FiveSeconds_True) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_FiveSeconds_False) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_TenSeconds_True) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_TenSeconds_False) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_FiveMinutes_True) {}

TEST_F(BrokenAlternativeServicesTest, ExponentialBackoff_FiveMinutes_False) {}

TEST_F(BrokenAlternativeServicesTest, RemoveExpiredBrokenAltSvc) {}

// Same as above, but checks a single alternative service with two different
// NetworkAnonymizationKeys.
TEST_F(BrokenAlternativeServicesTest,
       RemoveExpiredBrokenAltSvcWithNetworkAnonymizationKey) {}

TEST_F(BrokenAlternativeServicesTest, SetBrokenAlternativeServices) {}

TEST_F(BrokenAlternativeServicesTest,
       SetBrokenAlternativeServicesWithExisting) {}

TEST_F(BrokenAlternativeServicesTest, ScheduleExpireTaskAfterExpire) {}

TEST_F(BrokenAlternativeServicesTest, Clear) {}

}  // namespace

}  // namespace net