// 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. #ifndef URL_GURL_ABSTRACT_TESTS_H_ #define URL_GURL_ABSTRACT_TESTS_H_ // Test suite for tests that cover both url::Url and blink::SecurityUrl. // // AbstractUrlTest below abstracts away differences between GURL and blink::KURL // by parametrizing the tests with a class that has to expose the following // members: // using UrlType = ...; // static UrlType CreateUrlFromString(std::string_view s); // static bool IsAboutBlank(const UrlType& url); // static bool IsAboutSrcdoc(const UrlType& url); template <typename TUrlTraits> class AbstractUrlTest : public testing::Test { … }; TYPED_TEST_SUITE_P(…); TYPED_TEST_P(AbstractUrlTest, IsAboutBlankTest) { … } TYPED_TEST_P(AbstractUrlTest, IsAboutSrcdocTest) { … } REGISTER_TYPED_TEST_SUITE_P(…); #endif // URL_GURL_ABSTRACT_TESTS_H_