chromium/content/browser/origin_trials/critical_origin_trials_throttle_unittest.cc

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

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

#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/strcat.h"
#include "content/browser/origin_trials/critical_origin_trials_throttle.h"
#include "content/public/browser/origin_trials_controller_delegate.h"
#include "net/http/http_response_headers.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
#include "third_party/blink/public/common/origin_trials/scoped_test_origin_trial_policy.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
#include "third_party/blink/public/mojom/origin_trial_feature/origin_trial_feature.mojom-shared.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace content {

namespace {

ResourceType;

const char kExampleURL[] =;
const char kHttpHeaderPreamble[] =;
const char kOriginTrialHeader[] =;
const char kCriticalOriginTrialHeader[] =;
const char kCRLF[] =;
const char kHttpHeaderTerminator[] =;

const char kPersistentTrialName[] =;
const char kFakePersistentTrialName[] =;

// Generated with
// tools/origin_trials/generate_token.py https://example.com FrobulatePersistent
// --expire-timestamp=2000000000
const char kPersistentTrialToken[] =;

class MockOriginTrialsDelegate
    : public content::OriginTrialsControllerDelegate {};

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

TEST_F(CriticalOriginTrialsThrottleTest,
       StartRequestShouldStoreExistingPersistedTrials) {}

TEST_F(CriticalOriginTrialsThrottleTest,
       CriticalShouldRestartIfNotAlreadyPresent) {}

TEST_F(CriticalOriginTrialsThrottleTest,
       CriticalShouldRestartIfNotAlreadyPresentForSubframe) {}

TEST_F(CriticalOriginTrialsThrottleTest,
       CriticalShouldNotRestartIfNotAlreadyPresentForImageResource) {}

TEST_F(CriticalOriginTrialsThrottleTest, NoHeadersShouldNotRestartRequest) {}

TEST_F(CriticalOriginTrialsThrottleTest,
       NoCriticalHeadersShouldNotRestartRequest) {}

TEST_F(CriticalOriginTrialsThrottleTest,
       CriticalForNonRequestedTrialShouldNotRestart) {}

TEST_F(CriticalOriginTrialsThrottleTest,
       CriticalShouldNotRestartIfPreviouslySet) {}

}  // namespace

}  // namespace content