Commit dfa5e05a authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Revert "Add basic ServiceConnection unit test"

This reverts commit 453eba23.

Reason for revert: Failing Linux ASAN/LSAN bot: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8939853423518476256/+/steps/chromeos_unittests/0/logs/ServiceConnectionTest.BindModelProvider/0

Original change's description:
> Add basic ServiceConnection unit test
> 
> The is just testing that ServiceConnection::BindModelProvider returns
> successfully. The Mojo invitation won't go anywhere beyond the no-op
> FakeMachineLearningClient D-Bus client.
> 
> To make this test compile, I had to fix an #include from an
> overlooked file rename in an earlier CL ...
> 
> Bug: 863794
> 
> Change-Id: Ifd31fea950145561cd5954ae16e930b801bfe49b
> Reviewed-on: https://chromium-review.googlesource.com/1139942
> Commit-Queue: Andrew Moylan <amoylan@chromium.org>
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Reviewed-by: Dan Erat <derat@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#578329}

TBR=derat@chromium.org,rockot@chromium.org,amoylan@chromium.org

Change-Id: I9878dee8885c78f88c0af50e70e921861ab87663
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 863794
Reviewed-on: https://chromium-review.googlesource.com/1152371Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578632}
parent 1568d039
...@@ -15,7 +15,7 @@ void FakeMachineLearningClient::Init(dbus::Bus* const bus) {} ...@@ -15,7 +15,7 @@ void FakeMachineLearningClient::Init(dbus::Bus* const bus) {}
void FakeMachineLearningClient::BootstrapMojoConnection( void FakeMachineLearningClient::BootstrapMojoConnection(
base::ScopedFD fd, base::ScopedFD fd,
base::OnceCallback<void(bool success)> result_callback) { base::OnceCallback<void(bool success)> result_callback) {
const bool success = true; const bool success = false;
std::move(result_callback).Run(success); std::move(result_callback).Run(success);
} }
......
...@@ -22,7 +22,6 @@ source_set("unit_tests") { ...@@ -22,7 +22,6 @@ source_set("unit_tests") {
testonly = true testonly = true
deps = [ deps = [
"//chromeos/services/device_sync:unit_tests", "//chromeos/services/device_sync:unit_tests",
"//chromeos/services/machine_learning/public/cpp:unit_tests",
"//chromeos/services/multidevice_setup:unit_tests", "//chromeos/services/multidevice_setup:unit_tests",
"//chromeos/services/secure_channel:unit_tests", "//chromeos/services/secure_channel:unit_tests",
] ]
......
include_rules = [ include_rules = [
"+chromeos/dbus", "+chromeos/dbus",
"+mojo/core/embedder",
"+mojo/public", "+mojo/public",
] ]
...@@ -15,19 +15,3 @@ source_set("cpp") { ...@@ -15,19 +15,3 @@ source_set("cpp") {
"//chromeos/services/machine_learning/public/mojom", "//chromeos/services/machine_learning/public/mojom",
] ]
} }
source_set("unit_tests") {
testonly = true
sources = [
"service_connection_unittest.cc",
]
deps = [
":cpp",
"//base/test:test_support",
"//chromeos",
"//chromeos/services/machine_learning/public/mojom",
"//mojo/core/embedder",
"//mojo/public/cpp/bindings",
"//testing/gtest",
]
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/machine_learning_client.h" #include "chromeos/dbus/machine_learning_client.h"
#include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h" #include "chromeos/services/machine_learning/public/mojom/interface.mojom.h"
#include "mojo/public/cpp/platform/platform_channel.h" #include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h" #include "mojo/public/cpp/system/invitation.h"
#include "third_party/cros_system_api/dbus/service_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h"
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h" #include "chromeos/services/machine_learning/public/mojom/interface.mojom.h"
namespace chromeos { namespace chromeos {
namespace machine_learning { namespace machine_learning {
......
// Copyright 2018 The Chromium 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 "chromeos/services/machine_learning/public/cpp/service_connection.h"
#include "base/macros.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/services/machine_learning/public/mojom/machine_learning_service.mojom.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/core/embedder/scoped_ipc_support.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
namespace machine_learning {
namespace {
class ServiceConnectionTest : public testing::Test {
public:
ServiceConnectionTest() = default;
protected:
static void SetUpTestCase() {
DBusThreadManager::Initialize();
mojo::core::Init();
static base::Thread ipc_thread("ipc");
ipc_thread.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
static mojo::core::ScopedIPCSupport ipc_support(
ipc_thread.task_runner(),
mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN);
}
private:
base::test::ScopedTaskEnvironment scoped_task_environment_;
DISALLOW_COPY_AND_ASSIGN(ServiceConnectionTest);
};
// Tests that BindModelProvider runs OK (no crash) in a basic Mojo environment.
TEST_F(ServiceConnectionTest, BindModelProvider) {
mojom::ModelProviderPtr model_provider;
ServiceConnection::GetInstance()->BindModelProvider(
mojo::MakeRequest(&model_provider));
}
} // namespace
} // namespace machine_learning
} // namespace chromeos
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