chromium/components/web_package/test_support/mock_web_bundle_parser_factory.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_factory.h"

#include <optional>

#include "base/run_loop.h"
#include "base/test/test_future.h"
#include "base/threading/thread_restrictions.h"
#include "components/web_package/test_support/mock_web_bundle_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

namespace web_package {

MockWebBundleParserFactory::MockWebBundleParserFactory(
    base::RepeatingCallback<void(std::optional<GURL>)> on_create_parser)
    :{}

MockWebBundleParserFactory::~MockWebBundleParserFactory() = default;

void MockWebBundleParserFactory::AddReceiver(
    mojo::PendingReceiver<mojom::WebBundleParserFactory> receiver) {}

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

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

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

void MockWebBundleParserFactory::RunMetadataCallback(
    std::optional<uint64_t> expected_metadata_offset,
    mojom::BundleMetadataPtr metadata,
    web_package::mojom::BundleMetadataParseErrorPtr error) {}

void MockWebBundleParserFactory::RunResponseCallback(
    mojom::BundleResponseLocationPtr expected_parse_args,
    mojom::BundleResponsePtr response,
    mojom::BundleResponseParseErrorPtr error) {}

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

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

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

int MockWebBundleParserFactory::GetParserCreationCount() const {}

void MockWebBundleParserFactory::SimulateParserDisconnect() {}

void MockWebBundleParserFactory::SimulateParseIntegrityBlockCrash() {}

void MockWebBundleParserFactory::SimulateParseMetadataCrash() {}

void MockWebBundleParserFactory::SimulateParseResponseCrash() {}

void MockWebBundleParserFactory::GetParser(
    mojo::PendingReceiver<mojom::WebBundleParser> receiver,
    const std::optional<GURL>& base_url) {}

void MockWebBundleParserFactory::BindFileDataSource(
    mojo::PendingReceiver<mojom::BundleDataSource> data_source_receiver,
    base::File file) {}

void MockWebBundleParserFactory::GetParserForDataSource(
    mojo::PendingReceiver<mojom::WebBundleParser> receiver,
    const std::optional<GURL>& base_url,
    mojo::PendingRemote<mojom::BundleDataSource> data_source) {}

}  // namespace web_package