chromium/chrome/browser/controlled_frame/controlled_frame_wpt_browsertest.cc

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

#include <memory>
#include <string>

#include "base/base_paths.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/test/gmock_expected_support.h"
#include "chrome/browser/controlled_frame/controlled_frame_test_base.h"
#include "chrome/browser/controlled_frame/scoped_test_driver_proxy.h"
#include "chrome/browser/ui/web_applications/test/isolated_web_app_test_utils.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/browser/web_applications/isolated_web_apps/test/isolated_web_app_builder.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "services/device/public/cpp/test/scoped_geolocation_overrider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/permissions_policy/policy_helper_public.h"
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-shared.h"

namespace controlled_frame {

namespace {
auto kTestFiles =;

constexpr char kTestDirectory[] =;
constexpr char kTestHarnessPath[] =;
constexpr char kTestDriverPath[] =;

constexpr char kHtmlWrapperSrc[] =;

constexpr char kWptReporterSrc[] =;

}  // namespace

// These tests wrap WPT infrastructure in a browser test to allow us to run
// WPTs within an IWA. When IWA support is officially added to WPTs, we can
// move all the Javascript tests referenced here into the main WPT test
// directory and remove this test.
class ControlledFrameWptBrowserTest
    : public ControlledFrameTestBase,
      public testing::WithParamInterface<std::string> {};

// This test includes the WPT test harness and an adapter script that will:
//   * Register a completion callback with the test harness.
//   * Inject a script tag with a src equal to the URL query. This is how the
//     test configures which WPT *.window.js test file is run.
//   * Put the results in a top-level window.results promise that will contain
//     the list of passed tests if there were no failures, or reject the promise
//     with error information for failing tests otherwise.
IN_PROC_BROWSER_TEST_P(ControlledFrameWptBrowserTest, Run) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace controlled_frame