0
Files
src/content/web_test/renderer/blink_test_helpers.h
Avi Drissman 4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00

46 lines
1.8 KiB
C++

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_WEB_TEST_RENDERER_BLINK_TEST_HELPERS_H_
#define CONTENT_WEB_TEST_RENDERER_BLINK_TEST_HELPERS_H_
#include "base/strings/string_piece.h"
#include "third_party/blink/public/platform/web_url.h"
namespace blink {
namespace web_pref {
struct WebPreferences;
}
} // namespace blink
namespace content {
struct TestPreferences;
// The TestRunner library keeps its settings in a TestPreferences object.
// The content_shell, however, uses WebPreferences. This method exports the
// settings from the TestRunner library which are relevant for web tests.
void ExportWebTestSpecificPreferences(const TestPreferences& from,
blink::web_pref::WebPreferences* to);
// Rewrites a URL requested from a web test. There are two rules:
// 1. If the URL is an absolute file path requested from a WPT test like
// 'file:///resources/testharness.js', then return a file URL to the file
// under WPT test directory. This is used only when the test is run manually
// with content_shell without a web server.
// 2. If the URL starts with file:///tmp/web_tests/, then return a file URL
// to a temporary file under the web_tests directory.
// 3. If the URL starts with file:///gen/, then return a file URL to the file
// under the gen/ directory of the build out.
blink::WebURL RewriteWebTestsURL(base::StringPiece utf8_url, bool is_wpt_mode);
// Applies the rewrite rules except 1 of RewriteWebTestsURL().
blink::WebURL RewriteFileURLToLocalResource(base::StringPiece resource);
// Returns true if |test_url| points to a web platform test (WPT).
bool IsWebPlatformTest(base::StringPiece test_url);
} // namespace content
#endif // CONTENT_WEB_TEST_RENDERER_BLINK_TEST_HELPERS_H_