chromium/third_party/blink/renderer/core/permissions_policy/document_policy_sim_test.cc

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

#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/permissions_policy/policy_disposition.mojom-blink.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/permissions_policy/policy_helper.h"
#include "third_party/blink/renderer/core/testing/sim/sim_request.h"
#include "third_party/blink/renderer/core/testing/sim/sim_test.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"

namespace blink {

class DocumentPolicySimTest : public SimTest {};

// When runtime feature DocumentPolicyNegotiation is not enabled, specifying
// Require-Document-Policy HTTP header and policy attribute on iframe should
// have no effect, i.e. document load should not be blocked even if the required
// policy and incoming policy are incompatible. Document-Policy header should
// function as normal.
TEST_F(DocumentPolicySimTest, DocumentPolicyNegotiationNoEffectWhenFlagNotSet) {}

TEST_F(DocumentPolicySimTest, ReportDocumentPolicyHeaderParsingError) {}

TEST_F(DocumentPolicySimTest, ReportRequireDocumentPolicyHeaderParsingError) {}

TEST_F(DocumentPolicySimTest, ReportErrorWhenDocumentPolicyIncompatible) {}

// HTTP header Require-Document-Policy should only take effect on subtree of
// current document, but not on current document.
TEST_F(DocumentPolicySimTest,
       RequireDocumentPolicyHeaderShouldNotAffectCurrentDocument) {}

TEST_F(DocumentPolicySimTest, DocumentPolicyHeaderHistogramTest) {}

TEST_F(DocumentPolicySimTest, DocumentPolicyPolicyAttributeHistogramTest) {}

TEST_F(DocumentPolicySimTest, DocumentPolicyEnforcedReportHistogramTest) {}

TEST_F(DocumentPolicySimTest, DocumentPolicyReportOnlyReportHistogramTest) {}

class DocumentPolicyHeaderUseCounterTest
    : public DocumentPolicySimTest,
      public testing::WithParamInterface<std::tuple<bool, bool, bool>> {};

TEST_P(DocumentPolicyHeaderUseCounterTest, ShouldObserveUseCounterUpdate) {}

INSTANTIATE_TEST_SUITE_P();

TEST_F(DocumentPolicySimTest,
       DocumentPolicyIframePolicyAttributeUseCounterTest) {}

TEST_F(DocumentPolicySimTest, RequiredDocumentPolicyUseCounterTest) {}

}  // namespace blink