Commit f1a60854 authored by Fabrice de Gans-Riberi's avatar Fabrice de Gans-Riberi Committed by Commit Bot

[fuchsia] Remove fuchsia sub-namespace from the test FIDL interface

Bug: 1073821
Change-Id: Ib1659d8bde4d020d768ecbe6eb11bab81b5db662
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429610Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812450}
parent 569b31ab
...@@ -2629,9 +2629,9 @@ if (is_apple) { ...@@ -2629,9 +2629,9 @@ if (is_apple) {
if (is_fuchsia) { if (is_fuchsia) {
fidl_library("testfidl") { fidl_library("testfidl") {
library_name = "base.fuchsia.testfidl" library_name = "base.testfidl"
sources = [ "fuchsia/test.fidl" ] sources = [ "fuchsia/test.test-fidl" ]
} }
source_set("test_interface_impl") { source_set("test_interface_impl") {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/test_interface_impl.h" #include "base/fuchsia/test_interface_impl.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/test/scoped_run_loop_timeout.h" #include "base/test/scoped_run_loop_timeout.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/test_interface_impl.h" #include "base/fuchsia/test_interface_impl.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
library base.fuchsia.testfidl; library base.testfidl;
[Discoverable] [Discoverable]
protocol TestInterface { protocol TestInterface {
......
...@@ -10,40 +10,37 @@ ...@@ -10,40 +10,37 @@
#include "base/fuchsia/fuchsia_logging.h" #include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h" #include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace base { namespace base {
class TestComponentContextForProcessTest class TestComponentContextForProcessTest : public testing::Test,
: public testing::Test, public testfidl::TestInterface {
public fuchsia::testfidl::TestInterface {
public: public:
TestComponentContextForProcessTest() TestComponentContextForProcessTest()
: task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {} : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}
bool HasTestInterface() { bool HasTestInterface() {
return VerifyTestInterface( return VerifyTestInterface(ComponentContextForProcess()
ComponentContextForProcess()
->svc() ->svc()
->Connect<fuchsia::testfidl::TestInterface>()); ->Connect<testfidl::TestInterface>());
} }
bool HasPublishedTestInterface() { bool HasPublishedTestInterface() {
return VerifyTestInterface( return VerifyTestInterface(
test_context_.published_services() test_context_.published_services()->Connect<testfidl::TestInterface>());
->Connect<fuchsia::testfidl::TestInterface>());
} }
// fuchsia::testfidl::TestInterface implementation. // testfidl::TestInterface implementation.
void Add(int32_t a, int32_t b, AddCallback callback) override { void Add(int32_t a, int32_t b, AddCallback callback) override {
callback(a + b); callback(a + b);
} }
protected: protected:
bool VerifyTestInterface(fuchsia::testfidl::TestInterfacePtr test_interface) { bool VerifyTestInterface(testfidl::TestInterfacePtr test_interface) {
bool have_interface = false; bool have_interface = false;
RunLoop wait_loop; RunLoop wait_loop;
test_interface.set_error_handler([quit_loop = wait_loop.QuitClosure(), test_interface.set_error_handler([quit_loop = wait_loop.QuitClosure(),
...@@ -75,8 +72,8 @@ TEST_F(TestComponentContextForProcessTest, NoServices) { ...@@ -75,8 +72,8 @@ TEST_F(TestComponentContextForProcessTest, NoServices) {
TEST_F(TestComponentContextForProcessTest, InjectTestInterface) { TEST_F(TestComponentContextForProcessTest, InjectTestInterface) {
// Publish a fake TestInterface for the process' ComponentContext to expose. // Publish a fake TestInterface for the process' ComponentContext to expose.
base::fuchsia::ScopedServiceBinding<fuchsia::testfidl::TestInterface> base::fuchsia::ScopedServiceBinding<testfidl::TestInterface> service_binding(
service_binding(test_context_.additional_services(), this); test_context_.additional_services(), this);
// Verify that the TestInterface is accessible & usable. // Verify that the TestInterface is accessible & usable.
EXPECT_TRUE(HasTestInterface()); EXPECT_TRUE(HasTestInterface());
...@@ -84,8 +81,8 @@ TEST_F(TestComponentContextForProcessTest, InjectTestInterface) { ...@@ -84,8 +81,8 @@ TEST_F(TestComponentContextForProcessTest, InjectTestInterface) {
TEST_F(TestComponentContextForProcessTest, PublishTestInterface) { TEST_F(TestComponentContextForProcessTest, PublishTestInterface) {
// Publish TestInterface to the process' outgoing-directory. // Publish TestInterface to the process' outgoing-directory.
base::fuchsia::ScopedServiceBinding<fuchsia::testfidl::TestInterface> base::fuchsia::ScopedServiceBinding<testfidl::TestInterface> service_binding(
service_binding(ComponentContextForProcess()->outgoing().get(), this); ComponentContextForProcess()->outgoing().get(), this);
// Attempt to use the TestInterface from the outgoing-directory. // Attempt to use the TestInterface from the outgoing-directory.
EXPECT_TRUE(HasPublishedTestInterface()); EXPECT_TRUE(HasPublishedTestInterface());
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "base/fuchsia/test_interface_impl.h" #include "base/fuchsia/test_interface_impl.h"
namespace base { namespace base {
namespace fuchsia {
TestInterfaceImpl::TestInterfaceImpl() = default; TestInterfaceImpl::TestInterfaceImpl() = default;
TestInterfaceImpl::~TestInterfaceImpl() = default; TestInterfaceImpl::~TestInterfaceImpl() = default;
...@@ -14,5 +13,4 @@ void TestInterfaceImpl::Add(int32_t a, int32_t b, AddCallback callback) { ...@@ -14,5 +13,4 @@ void TestInterfaceImpl::Add(int32_t a, int32_t b, AddCallback callback) {
callback(a + b); callback(a + b);
} }
} // namespace fuchsia
} // namespace base } // namespace base
...@@ -8,10 +8,9 @@ ...@@ -8,10 +8,9 @@
#include <lib/fidl/cpp/binding_set.h> #include <lib/fidl/cpp/binding_set.h>
#include <lib/zx/channel.h> #include <lib/zx/channel.h>
#include "base/fuchsia/testfidl/cpp/fidl.h" #include "base/testfidl/cpp/fidl.h"
namespace base { namespace base {
namespace fuchsia {
class TestInterfaceImpl : public testfidl::TestInterface { class TestInterfaceImpl : public testfidl::TestInterface {
public: public:
...@@ -27,7 +26,6 @@ class TestInterfaceImpl : public testfidl::TestInterface { ...@@ -27,7 +26,6 @@ class TestInterfaceImpl : public testfidl::TestInterface {
fidl::BindingSet<testfidl::TestInterface> bindings_; fidl::BindingSet<testfidl::TestInterface> bindings_;
}; };
} // namespace fuchsia
} // namespace base } // namespace base
#endif // BASE_FUCHSIA_FAKE_INTERFACE_IMPL_H_ #endif // BASE_FUCHSIA_FAKE_INTERFACE_IMPL_H_
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include <lib/sys/cpp/component_context.h> #include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/fuchsia_logging.h" #include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "fuchsia/base/fit_adapter.h" #include "fuchsia/base/fit_adapter.h"
#include "fuchsia/base/result_receiver.h" #include "fuchsia/base/result_receiver.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -29,8 +29,7 @@ class EmptyComponentState : public AgentImpl::ComponentStateBase { ...@@ -29,8 +29,7 @@ class EmptyComponentState : public AgentImpl::ComponentStateBase {
: ComponentStateBase(component) {} : ComponentStateBase(component) {}
}; };
class AccumulatingTestInterfaceImpl class AccumulatingTestInterfaceImpl : public base::testfidl::TestInterface {
: public base::fuchsia::testfidl::TestInterface {
public: public:
AccumulatingTestInterfaceImpl() = default; AccumulatingTestInterfaceImpl() = default;
...@@ -54,7 +53,7 @@ class AccumulatorComponentState : public AgentImpl::ComponentStateBase { ...@@ -54,7 +53,7 @@ class AccumulatorComponentState : public AgentImpl::ComponentStateBase {
protected: protected:
AccumulatingTestInterfaceImpl service_; AccumulatingTestInterfaceImpl service_;
base::fuchsia::ScopedServiceBinding<base::fuchsia::testfidl::TestInterface> base::fuchsia::ScopedServiceBinding<base::testfidl::TestInterface>
service_binding_; service_binding_;
}; };
...@@ -170,13 +169,13 @@ TEST_F(AgentImplTest, DifferentComponentIdSameService) { ...@@ -170,13 +169,13 @@ TEST_F(AgentImplTest, DifferentComponentIdSameService) {
agent->Connect(kAccumulatorComponentId2, component_services2.NewRequest()); agent->Connect(kAccumulatorComponentId2, component_services2.NewRequest());
// Request the TestInterface from each of the service directories. // Request the TestInterface from each of the service directories.
base::fuchsia::testfidl::TestInterfacePtr test_interface1; base::testfidl::TestInterfacePtr test_interface1;
component_services1->ConnectToService( component_services1->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel()); test_interface1.NewRequest().TakeChannel());
base::fuchsia::testfidl::TestInterfacePtr test_interface2; base::testfidl::TestInterfacePtr test_interface2;
component_services2->ConnectToService( component_services2->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel()); test_interface1.NewRequest().TakeChannel());
// Both TestInterface pointers should remain valid until we are done. // Both TestInterface pointers should remain valid until we are done.
...@@ -226,13 +225,13 @@ TEST_F(AgentImplTest, SameComponentIdSameService) { ...@@ -226,13 +225,13 @@ TEST_F(AgentImplTest, SameComponentIdSameService) {
agent->Connect(kAccumulatorComponentId1, component_services2.NewRequest()); agent->Connect(kAccumulatorComponentId1, component_services2.NewRequest());
// Request the TestInterface from each of the service directories. // Request the TestInterface from each of the service directories.
base::fuchsia::testfidl::TestInterfacePtr test_interface1; base::testfidl::TestInterfacePtr test_interface1;
component_services1->ConnectToService( component_services1->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel()); test_interface1.NewRequest().TakeChannel());
base::fuchsia::testfidl::TestInterfacePtr test_interface2; base::testfidl::TestInterfacePtr test_interface2;
component_services2->ConnectToService( component_services2->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel()); test_interface1.NewRequest().TakeChannel());
// Both TestInterface pointers should remain valid until we are done. // Both TestInterface pointers should remain valid until we are done.
...@@ -279,9 +278,9 @@ TEST_F(AgentImplTest, KeepAliveBinding) { ...@@ -279,9 +278,9 @@ TEST_F(AgentImplTest, KeepAliveBinding) {
// Connect to the Agent and request the TestInterface. // Connect to the Agent and request the TestInterface.
fuchsia::sys::ServiceProviderPtr component_services; fuchsia::sys::ServiceProviderPtr component_services;
agent->Connect(kAccumulatorComponentId1, component_services.NewRequest()); agent->Connect(kAccumulatorComponentId1, component_services.NewRequest());
base::fuchsia::testfidl::TestInterfacePtr test_interface; base::testfidl::TestInterfacePtr test_interface;
component_services->ConnectToService( component_services->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface.NewRequest().TakeChannel()); test_interface.NewRequest().TakeChannel());
// The TestInterface pointer should be closed as soon as we Unbind() the // The TestInterface pointer should be closed as soon as we Unbind() the
...@@ -299,9 +298,9 @@ TEST_F(AgentImplTest, KeepAliveBinding) { ...@@ -299,9 +298,9 @@ TEST_F(AgentImplTest, KeepAliveBinding) {
// Connect to the Agent and request the TestInterface. // Connect to the Agent and request the TestInterface.
fuchsia::sys::ServiceProviderPtr component_services; fuchsia::sys::ServiceProviderPtr component_services;
agent->Connect(kKeepAliveComponentId, component_services.NewRequest()); agent->Connect(kKeepAliveComponentId, component_services.NewRequest());
base::fuchsia::testfidl::TestInterfacePtr test_interface; base::testfidl::TestInterfacePtr test_interface;
component_services->ConnectToService( component_services->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface.NewRequest().TakeChannel()); test_interface.NewRequest().TakeChannel());
// The TestInterface pointer should remain valid until we are done. // The TestInterface pointer should remain valid until we are done.
...@@ -329,9 +328,9 @@ TEST_F(AgentImplTest, DisconnectClientsAndTeardown) { ...@@ -329,9 +328,9 @@ TEST_F(AgentImplTest, DisconnectClientsAndTeardown) {
// Connect to the Agent and request the TestInterface. // Connect to the Agent and request the TestInterface.
fuchsia::sys::ServiceProviderPtr component_services; fuchsia::sys::ServiceProviderPtr component_services;
agent->Connect(kKeepAliveComponentId, component_services.NewRequest()); agent->Connect(kKeepAliveComponentId, component_services.NewRequest());
base::fuchsia::testfidl::TestInterfacePtr test_interface; base::testfidl::TestInterfacePtr test_interface;
component_services->ConnectToService( component_services->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_, base::testfidl::TestInterface::Name_,
test_interface.NewRequest().TakeChannel()); test_interface.NewRequest().TakeChannel());
// The TestInterface pointer should remain valid until we call // The TestInterface pointer should remain valid until we call
......
...@@ -15,13 +15,13 @@ mojom("example_interfaces") { ...@@ -15,13 +15,13 @@ mojom("example_interfaces") {
types = [ types = [
{ {
mojom = "fuchsia.test.mojom.TestInterfaceRequest" mojom = "fuchsia.test.mojom.TestInterfaceRequest"
cpp = "::fidl::InterfaceRequest<::base::fuchsia::testfidl::TestInterface>" cpp = "::fidl::InterfaceRequest<::base::testfidl::TestInterface>"
move_only = true move_only = true
}, },
] ]
traits_headers = [ traits_headers = [
"//base/fuchsia/testfidl/cpp/fidl.h", "//base/testfidl/cpp/fidl.h",
"//fuchsia/mojom/test_interface_request_mojom_traits.h", "//fuchsia/mojom/test_interface_request_mojom_traits.h",
] ]
traits_public_deps = [ traits_public_deps = [
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "fuchsia/mojom/example.mojom.h" #include "fuchsia/mojom/example.mojom.h"
#include "fuchsia/mojom/test_interface_request_mojom_traits.h" #include "fuchsia/mojom/test_interface_request_mojom_traits.h"
#include "mojo/public/cpp/test_support/test_utils.h" #include "mojo/public/cpp/test_support/test_utils.h"
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
namespace fuchsia { namespace fuchsia {
using base::fuchsia::testfidl::TestInterface; using base::testfidl::TestInterface;
using base::fuchsia::testfidl::TestInterfacePtr; using base::testfidl::TestInterfacePtr;
TEST(InterfaceRequestStructTraitsTest, Serialization) { TEST(InterfaceRequestStructTraitsTest, Serialization) {
base::test::SingleThreadTaskEnvironment task_environment( base::test::SingleThreadTaskEnvironment task_environment(
......
...@@ -10,12 +10,11 @@ ...@@ -10,12 +10,11 @@
namespace mojo { namespace mojo {
template <> template <>
struct StructTraits< struct StructTraits<fuchsia::test::mojom::TestInterfaceRequestDataView,
fuchsia::test::mojom::TestInterfaceRequestDataView, fidl::InterfaceRequest<base::testfidl::TestInterface>>
fidl::InterfaceRequest<base::fuchsia::testfidl::TestInterface>>
: public FidlInterfaceRequestStructTraits< : public FidlInterfaceRequestStructTraits<
fuchsia::test::mojom::TestInterfaceRequestDataView, fuchsia::test::mojom::TestInterfaceRequestDataView,
base::fuchsia::testfidl::TestInterface> {}; base::testfidl::TestInterface> {};
} // namespace mojo } // namespace mojo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment