#include "services/data_decoder/public/cpp/safe_web_bundle_parser.h"
#include <memory>
#include <optional>
#include <string>
#include "base/files/file_path.h"
#include "base/functional/callback_helpers.h"
#include "base/path_service.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "components/web_package/mojom/web_bundle_parser.mojom.h"
#include "components/web_package/signed_web_bundles/constants.h"
#include "components/web_package/test_support/signed_web_bundles/signature_verifier_test_utils.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
namespace data_decoder {
namespace {
UnorderedElementsAreArray;
constexpr char kConnectionError[] = …;
base::File OpenTestFile(const base::FilePath& path) { … }
class MockFactory final : public web_package::mojom::WebBundleParserFactory { … };
class MockDataSource final : public web_package::mojom::BundleDataSource { … };
}
class SafeWebBundleParserTest : public testing::Test { … };
TEST_F(SafeWebBundleParserTest, ParseGoldenFile) { … }
TEST_F(SafeWebBundleParserTest, OpenInvalidFile) { … }
TEST_F(SafeWebBundleParserTest, UseMockFactory) { … }
TEST_F(SafeWebBundleParserTest, ConnectionError) { … }
struct IntegrityBlockInfo { … };
class SafeSignedWebBundleParserTest
: public SafeWebBundleParserTest,
public testing::WithParamInterface<
std::tuple<base::FilePath, IntegrityBlockInfo, std::string>> { … };
TEST_P(SafeSignedWebBundleParserTest, ParseSignedWebBundle) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(SafeWebBundleParserTest, ParseWebBundleWithRelativeUrls) { … }
class TestDataSourceCreatingStrategy : public DataSourceCreatingStrategy { … };
TEST_F(SafeWebBundleParserTest, Close) { … }
}