blob: ae030d5a59a2ad285b5d895d06989dedf5657c18 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/sys/cpp/service_directory.h>
#include <stdio.h>
#include <fidl/examples/routing/echo/cpp/fidl.h>
#include "gtest/gtest.h"
#include "lib/fidl/cpp/binding.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"
TEST(EchoTest, TestEcho) {
async::Loop loop(&kAsyncLoopConfigAttachToCurrentThread);
auto service = sys::ServiceDirectory::CreateFromNamespace();
fidl::examples::routing::echo::EchoSyncPtr echo;
service->Connect(echo.NewRequest());
fidl::StringPtr response = "";
ASSERT_EQ(ZX_OK, echo->EchoString("test string", &response));
EXPECT_EQ(response, "test string");
}