chromium/components/web_package/test_support/mock_web_bundle_parser.cc

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

#include "components/web_package/test_support/mock_web_bundle_parser.h"

#include "mojo/public/cpp/bindings/pending_receiver.h"

namespace web_package {

MockWebBundleParser::MockWebBundleParser(
    mojo::PendingReceiver<mojom::WebBundleParser> receiver,
    bool simulate_parse_integrity_block_crash,
    bool simulate_parse_metadata_crash,
    bool simulate_parse_response_crash)
    :{}

MockWebBundleParser::MockWebBundleParser(
    mojo::PendingReceiver<mojom::WebBundleParser> receiver,
    bool simulate_parse_integrity_block_crash,
    bool simulate_parse_metadata_crash,
    bool simulate_parse_response_crash,
    std::unique_ptr<MockWebBundleParser> disconnected_parser)
    :{}

MockWebBundleParser::~MockWebBundleParser() = default;

void MockWebBundleParser::RunIntegrityBlockCallback(
    mojom::BundleIntegrityBlockPtr integrity_block,
    mojom::BundleIntegrityBlockParseErrorPtr error) {}

void MockWebBundleParser::RunMetadataCallback(
    mojom::BundleMetadataPtr metadata,
    web_package::mojom::BundleMetadataParseErrorPtr error) {}

void MockWebBundleParser::RunResponseCallback(
    mojom::BundleResponsePtr response,
    mojom::BundleResponseParseErrorPtr error) {}

void MockWebBundleParser::WaitUntilParseIntegrityBlockCalled(
    base::OnceClosure closure) {}

void MockWebBundleParser::WaitUntilParseMetadataCalled(
    base::OnceCallback<void(std::optional<uint64_t> offset)> callback) {}

void MockWebBundleParser::WaitUntilParseResponseCalled(
    base::OnceCallback<void(mojom::BundleResponseLocationPtr)> callback) {}

void MockWebBundleParser::SetIntegrityBlockParseResult(
    mojom::BundleIntegrityBlockPtr integrity_block,
    mojom::BundleIntegrityBlockParseErrorPtr error) {}

void MockWebBundleParser::SetMetadataParseResult(
    mojom::BundleMetadataPtr metadata,
    web_package::mojom::BundleMetadataParseErrorPtr error) {}

void MockWebBundleParser::SetResponseParseResult(
    mojom::BundleResponsePtr response,
    mojom::BundleResponseParseErrorPtr error) {}

void MockWebBundleParser::ParseIntegrityBlock(
    ParseIntegrityBlockCallback callback) {}

void MockWebBundleParser::ParseMetadata(std::optional<uint64_t> offset,
                                        ParseMetadataCallback callback) {}

void MockWebBundleParser::ParseResponse(uint64_t response_offset,
                                        uint64_t response_length,
                                        ParseResponseCallback callback) {}

void MockWebBundleParser::Close(CloseCallback callback) {}

}  // namespace web_package