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) {
if (is_fuchsia) {
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") {
......
......@@ -12,9 +12,9 @@
#include "base/fuchsia/scoped_service_binding.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/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
......
......@@ -11,9 +11,9 @@
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/test_interface_impl.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library base.fuchsia.testfidl;
library base.testfidl;
[Discoverable]
protocol TestInterface {
......
......@@ -10,40 +10,37 @@
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
class TestComponentContextForProcessTest
: public testing::Test,
public fuchsia::testfidl::TestInterface {
class TestComponentContextForProcessTest : public testing::Test,
public testfidl::TestInterface {
public:
TestComponentContextForProcessTest()
: task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}
bool HasTestInterface() {
return VerifyTestInterface(
ComponentContextForProcess()
->svc()
->Connect<fuchsia::testfidl::TestInterface>());
return VerifyTestInterface(ComponentContextForProcess()
->svc()
->Connect<testfidl::TestInterface>());
}
bool HasPublishedTestInterface() {
return VerifyTestInterface(
test_context_.published_services()
->Connect<fuchsia::testfidl::TestInterface>());
test_context_.published_services()->Connect<testfidl::TestInterface>());
}
// fuchsia::testfidl::TestInterface implementation.
// testfidl::TestInterface implementation.
void Add(int32_t a, int32_t b, AddCallback callback) override {
callback(a + b);
}
protected:
bool VerifyTestInterface(fuchsia::testfidl::TestInterfacePtr test_interface) {
bool VerifyTestInterface(testfidl::TestInterfacePtr test_interface) {
bool have_interface = false;
RunLoop wait_loop;
test_interface.set_error_handler([quit_loop = wait_loop.QuitClosure(),
......@@ -75,8 +72,8 @@ TEST_F(TestComponentContextForProcessTest, NoServices) {
TEST_F(TestComponentContextForProcessTest, InjectTestInterface) {
// Publish a fake TestInterface for the process' ComponentContext to expose.
base::fuchsia::ScopedServiceBinding<fuchsia::testfidl::TestInterface>
service_binding(test_context_.additional_services(), this);
base::fuchsia::ScopedServiceBinding<testfidl::TestInterface> service_binding(
test_context_.additional_services(), this);
// Verify that the TestInterface is accessible & usable.
EXPECT_TRUE(HasTestInterface());
......@@ -84,8 +81,8 @@ TEST_F(TestComponentContextForProcessTest, InjectTestInterface) {
TEST_F(TestComponentContextForProcessTest, PublishTestInterface) {
// Publish TestInterface to the process' outgoing-directory.
base::fuchsia::ScopedServiceBinding<fuchsia::testfidl::TestInterface>
service_binding(ComponentContextForProcess()->outgoing().get(), this);
base::fuchsia::ScopedServiceBinding<testfidl::TestInterface> service_binding(
ComponentContextForProcess()->outgoing().get(), this);
// Attempt to use the TestInterface from the outgoing-directory.
EXPECT_TRUE(HasPublishedTestInterface());
......
......@@ -5,7 +5,6 @@
#include "base/fuchsia/test_interface_impl.h"
namespace base {
namespace fuchsia {
TestInterfaceImpl::TestInterfaceImpl() = default;
TestInterfaceImpl::~TestInterfaceImpl() = default;
......@@ -14,5 +13,4 @@ void TestInterfaceImpl::Add(int32_t a, int32_t b, AddCallback callback) {
callback(a + b);
}
} // namespace fuchsia
} // namespace base
......@@ -8,10 +8,9 @@
#include <lib/fidl/cpp/binding_set.h>
#include <lib/zx/channel.h>
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/testfidl/cpp/fidl.h"
namespace base {
namespace fuchsia {
class TestInterfaceImpl : public testfidl::TestInterface {
public:
......@@ -27,7 +26,6 @@ class TestInterfaceImpl : public testfidl::TestInterface {
fidl::BindingSet<testfidl::TestInterface> bindings_;
};
} // namespace fuchsia
} // namespace base
#endif // BASE_FUCHSIA_FAKE_INTERFACE_IMPL_H_
......@@ -7,9 +7,9 @@
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/logging.h"
#include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "fuchsia/base/fit_adapter.h"
#include "fuchsia/base/result_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -29,8 +29,7 @@ class EmptyComponentState : public AgentImpl::ComponentStateBase {
: ComponentStateBase(component) {}
};
class AccumulatingTestInterfaceImpl
: public base::fuchsia::testfidl::TestInterface {
class AccumulatingTestInterfaceImpl : public base::testfidl::TestInterface {
public:
AccumulatingTestInterfaceImpl() = default;
......@@ -54,7 +53,7 @@ class AccumulatorComponentState : public AgentImpl::ComponentStateBase {
protected:
AccumulatingTestInterfaceImpl service_;
base::fuchsia::ScopedServiceBinding<base::fuchsia::testfidl::TestInterface>
base::fuchsia::ScopedServiceBinding<base::testfidl::TestInterface>
service_binding_;
};
......@@ -170,13 +169,13 @@ TEST_F(AgentImplTest, DifferentComponentIdSameService) {
agent->Connect(kAccumulatorComponentId2, component_services2.NewRequest());
// Request the TestInterface from each of the service directories.
base::fuchsia::testfidl::TestInterfacePtr test_interface1;
base::testfidl::TestInterfacePtr test_interface1;
component_services1->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel());
base::fuchsia::testfidl::TestInterfacePtr test_interface2;
base::testfidl::TestInterfacePtr test_interface2;
component_services2->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel());
// Both TestInterface pointers should remain valid until we are done.
......@@ -226,13 +225,13 @@ TEST_F(AgentImplTest, SameComponentIdSameService) {
agent->Connect(kAccumulatorComponentId1, component_services2.NewRequest());
// Request the TestInterface from each of the service directories.
base::fuchsia::testfidl::TestInterfacePtr test_interface1;
base::testfidl::TestInterfacePtr test_interface1;
component_services1->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel());
base::fuchsia::testfidl::TestInterfacePtr test_interface2;
base::testfidl::TestInterfacePtr test_interface2;
component_services2->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface1.NewRequest().TakeChannel());
// Both TestInterface pointers should remain valid until we are done.
......@@ -279,9 +278,9 @@ TEST_F(AgentImplTest, KeepAliveBinding) {
// Connect to the Agent and request the TestInterface.
fuchsia::sys::ServiceProviderPtr component_services;
agent->Connect(kAccumulatorComponentId1, component_services.NewRequest());
base::fuchsia::testfidl::TestInterfacePtr test_interface;
base::testfidl::TestInterfacePtr test_interface;
component_services->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface.NewRequest().TakeChannel());
// The TestInterface pointer should be closed as soon as we Unbind() the
......@@ -299,9 +298,9 @@ TEST_F(AgentImplTest, KeepAliveBinding) {
// Connect to the Agent and request the TestInterface.
fuchsia::sys::ServiceProviderPtr component_services;
agent->Connect(kKeepAliveComponentId, component_services.NewRequest());
base::fuchsia::testfidl::TestInterfacePtr test_interface;
base::testfidl::TestInterfacePtr test_interface;
component_services->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface.NewRequest().TakeChannel());
// The TestInterface pointer should remain valid until we are done.
......@@ -329,9 +328,9 @@ TEST_F(AgentImplTest, DisconnectClientsAndTeardown) {
// Connect to the Agent and request the TestInterface.
fuchsia::sys::ServiceProviderPtr component_services;
agent->Connect(kKeepAliveComponentId, component_services.NewRequest());
base::fuchsia::testfidl::TestInterfacePtr test_interface;
base::testfidl::TestInterfacePtr test_interface;
component_services->ConnectToService(
base::fuchsia::testfidl::TestInterface::Name_,
base::testfidl::TestInterface::Name_,
test_interface.NewRequest().TakeChannel());
// The TestInterface pointer should remain valid until we call
......
......@@ -15,13 +15,13 @@ mojom("example_interfaces") {
types = [
{
mojom = "fuchsia.test.mojom.TestInterfaceRequest"
cpp = "::fidl::InterfaceRequest<::base::fuchsia::testfidl::TestInterface>"
cpp = "::fidl::InterfaceRequest<::base::testfidl::TestInterface>"
move_only = true
},
]
traits_headers = [
"//base/fuchsia/testfidl/cpp/fidl.h",
"//base/testfidl/cpp/fidl.h",
"//fuchsia/mojom/test_interface_request_mojom_traits.h",
]
traits_public_deps = [
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/test/task_environment.h"
#include "base/testfidl/cpp/fidl.h"
#include "fuchsia/mojom/example.mojom.h"
#include "fuchsia/mojom/test_interface_request_mojom_traits.h"
#include "mojo/public/cpp/test_support/test_utils.h"
......@@ -11,8 +11,8 @@
namespace fuchsia {
using base::fuchsia::testfidl::TestInterface;
using base::fuchsia::testfidl::TestInterfacePtr;
using base::testfidl::TestInterface;
using base::testfidl::TestInterfacePtr;
TEST(InterfaceRequestStructTraitsTest, Serialization) {
base::test::SingleThreadTaskEnvironment task_environment(
......
......@@ -10,12 +10,11 @@
namespace mojo {
template <>
struct StructTraits<
fuchsia::test::mojom::TestInterfaceRequestDataView,
fidl::InterfaceRequest<base::fuchsia::testfidl::TestInterface>>
struct StructTraits<fuchsia::test::mojom::TestInterfaceRequestDataView,
fidl::InterfaceRequest<base::testfidl::TestInterface>>
: public FidlInterfaceRequestStructTraits<
fuchsia::test::mojom::TestInterfaceRequestDataView,
base::fuchsia::testfidl::TestInterface> {};
base::testfidl::TestInterface> {};
} // 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