1 // Copyright 2018 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. 4 5 #ifndef BASE_FUCHSIA_TEST_INTERFACE_IMPL_H_ 6 #define BASE_FUCHSIA_TEST_INTERFACE_IMPL_H_ 7 8 #include <lib/fidl/cpp/binding_set.h> 9 #include <lib/zx/channel.h> 10 #include <zircon/types.h> 11 12 #include "base/testfidl/cpp/fidl.h" 13 14 namespace base { 15 16 class TestInterfaceImpl : public testfidl::TestInterface { 17 public: 18 TestInterfaceImpl(); 19 ~TestInterfaceImpl() override; 20 21 // TestInterface implementation: 22 void Add(int32_t a, int32_t b, AddCallback callback) override; 23 bindings()24 fidl::BindingSet<testfidl::TestInterface>& bindings() { return bindings_; } 25 26 private: 27 fidl::BindingSet<testfidl::TestInterface> bindings_; 28 }; 29 30 // Exercises the `TestInterface` channel identified by `ptr`, returning 31 // `ZX_OK` on success. Any error-handler for `ptr` will be removed before this 32 // function returns. 33 zx_status_t VerifyTestInterface( 34 fidl::InterfacePtr<testfidl::TestInterface>& ptr); 35 36 } // namespace base 37 38 #endif // BASE_FUCHSIA_TEST_INTERFACE_IMPL_H_ 39