Upload upstream chromium 76.0.3809.146
[platform/framework/web/chromium-efl.git] / base / fuchsia / service_directory_test_base.h
1 // Copyright 2018 The Chromium Authors. All rights reserved.
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_SERVICE_DIRECTORY_TEST_BASE_H_
6 #define BASE_FUCHSIA_SERVICE_DIRECTORY_TEST_BASE_H_
7
8 #include <lib/zx/channel.h>
9 #include <memory>
10
11 #include "base/fuchsia/scoped_service_binding.h"
12 #include "base/fuchsia/service_directory_client.h"
13 #include "base/fuchsia/test_interface_impl.h"
14 #include "base/fuchsia/testfidl/cpp/fidl.h"
15 #include "base/message_loop/message_loop.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17
18 namespace base {
19 namespace fuchsia {
20
21 class ServiceDirectoryTestBase : public testing::Test {
22  public:
23   ServiceDirectoryTestBase();
24   ~ServiceDirectoryTestBase() override;
25
26   void VerifyTestInterface(fidl::InterfacePtr<testfidl::TestInterface>* stub,
27                            zx_status_t expected_error);
28
29  protected:
30   MessageLoopForIO message_loop_;
31
32   std::unique_ptr<ServiceDirectory> service_directory_;
33   TestInterfaceImpl test_service_;
34   std::unique_ptr<ScopedServiceBinding<testfidl::TestInterface>>
35       service_binding_;
36
37   std::unique_ptr<ServiceDirectoryClient> public_service_directory_client_;
38   std::unique_ptr<ServiceDirectoryClient> debug_service_directory_client_;
39   std::unique_ptr<ServiceDirectoryClient>
40       legacy_public_service_directory_client_;
41   std::unique_ptr<ServiceDirectoryClient> root_service_directory_client_;
42
43   DISALLOW_COPY_AND_ASSIGN(ServiceDirectoryTestBase);
44 };
45
46 }  // namespace fuchsia
47 }  // namespace base
48
49 #endif  // BASE_FUCHSIA_SERVICE_DIRECTORY_TEST_BASE_H_