1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_MOCK_REALM_H_
6 #define COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_MOCK_REALM_H_
8 #include <fuchsia/component/cpp/fidl_test_base.h>
10 #include "base/fuchsia/scoped_service_binding.h"
11 #include "testing/gmock/include/gmock/gmock.h"
14 class OutgoingDirectory;
17 namespace fuchsia_component_support {
19 // A Mock for tests that wish to validate interactions with
20 // fuchsia.component/Realm.
21 class MockRealm : public fuchsia::component::testing::Realm_TestBase {
23 // Publishes the instance in the given outgoing directory.
24 explicit MockRealm(sys::OutgoingDirectory* outgoing);
25 ~MockRealm() override;
27 // fuchsia::component::testing::Realm_TestBase:
30 (fuchsia::component::decl::ChildRef child,
31 fidl::InterfaceRequest<fuchsia::io::Directory> exposed_dir,
32 fuchsia::component::Realm::OpenExposedDirCallback callback),
36 (fuchsia::component::decl::CollectionRef collection,
37 fuchsia::component::decl::Child decl,
38 fuchsia::component::CreateChildArgs args,
39 fuchsia::component::Realm::CreateChildCallback callback),
43 (fuchsia::component::decl::ChildRef child,
44 fuchsia::component::Realm::DestroyChildCallback callback),
46 void NotImplemented_(const std::string& name) override;
49 base::ScopedServiceBinding<fuchsia::component::Realm> binding_;
52 } // namespace fuchsia_component_support
54 #endif // COMPONENTS_FUCHSIA_COMPONENT_SUPPORT_MOCK_REALM_H_