chromium/components/web_package/test_support/mock_web_bundle_parser_factory.h

// 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.

#ifndef COMPONENTS_WEB_PACKAGE_TEST_SUPPORT_MOCK_WEB_BUNDLE_PARSER_FACTORY_H_
#define COMPONENTS_WEB_PACKAGE_TEST_SUPPORT_MOCK_WEB_BUNDLE_PARSER_FACTORY_H_

#include <optional>

#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "components/web_package/mojom/web_bundle_parser.mojom.h"
#include "components/web_package/test_support/mock_web_bundle_parser.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "url/gurl.h"

namespace web_package {

// There are two main ways tests can interact with this class. The more verbose
// way, which is most useful in unit tests, involves calling the
// `WaitUntilParse*Called`, followed by `Run*Callback`. This allows the test to
// verify both the arguments that the parser was called with, as well as to set
// the parse results.
// The second way to use this class are the `Set*ParseResult` methods. These
// must be called before the parser is used, and will cause the parser to return
// the values passed to the setters. This is most useful in browser tests, where
// the test does not have fine-grained control over when the the parser is used.
class MockWebBundleParserFactory final : public mojom::WebBundleParserFactory {};

}  // namespace web_package

#endif  // COMPONENTS_WEB_PACKAGE_TEST_SUPPORT_MOCK_WEB_BUNDLE_PARSER_FACTORY_H_