summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/arc.gypi2
-rw-r--r--components/arc/BUILD.gn2
-rw-r--r--components/arc/arc_bridge_bootstrap.cc1
-rw-r--r--components/arc/arc_bridge_service_unittest.cc34
-rw-r--r--components/arc/arc_service_manager.cc27
-rw-r--r--components/arc/arc_service_manager.h4
-rw-r--r--components/arc/test/fake_arc_bridge_bootstrap.cc33
-rw-r--r--components/arc/test/fake_arc_bridge_bootstrap.h34
8 files changed, 36 insertions, 101 deletions
diff --git a/components/arc.gypi b/components/arc.gypi
index 88d2aa6..6076304 100644
--- a/components/arc.gypi
+++ b/components/arc.gypi
@@ -73,8 +73,6 @@
'sources': [
'arc/test/fake_app_instance.cc',
'arc/test/fake_app_instance.h',
- 'arc/test/fake_arc_bridge_bootstrap.cc',
- 'arc/test/fake_arc_bridge_bootstrap.h',
'arc/test/fake_arc_bridge_instance.cc',
'arc/test/fake_arc_bridge_instance.h',
'arc/test/fake_arc_bridge_service.cc',
diff --git a/components/arc/BUILD.gn b/components/arc/BUILD.gn
index 70a07ae..68d79b8 100644
--- a/components/arc/BUILD.gn
+++ b/components/arc/BUILD.gn
@@ -89,8 +89,6 @@ static_library("arc_test_support") {
sources = [
"test/fake_app_instance.cc",
"test/fake_app_instance.h",
- "test/fake_arc_bridge_bootstrap.cc",
- "test/fake_arc_bridge_bootstrap.h",
"test/fake_arc_bridge_instance.cc",
"test/fake_arc_bridge_instance.h",
"test/fake_arc_bridge_service.cc",
diff --git a/components/arc/arc_bridge_bootstrap.cc b/components/arc/arc_bridge_bootstrap.cc
index c9e44a1..1d7a94f 100644
--- a/components/arc/arc_bridge_bootstrap.cc
+++ b/components/arc/arc_bridge_bootstrap.cc
@@ -341,7 +341,6 @@ void ArcBridgeBootstrapImpl::SetState(State state) {
} // namespace
ArcBridgeBootstrap::ArcBridgeBootstrap() {}
-
ArcBridgeBootstrap::~ArcBridgeBootstrap() {}
// static
diff --git a/components/arc/arc_bridge_service_unittest.cc b/components/arc/arc_bridge_service_unittest.cc
index e3eae59..c753f23 100644
--- a/components/arc/arc_bridge_service_unittest.cc
+++ b/components/arc/arc_bridge_service_unittest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/macros.h"
#include "base/run_loop.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/arc/arc_bridge_service_impl.h"
-#include "components/arc/test/fake_arc_bridge_bootstrap.h"
#include "components/arc/test/fake_arc_bridge_instance.h"
#include "ipc/mojo/scoped_ipc_support.h"
#include "mojo/public/cpp/system/message_pipe.h"
@@ -16,6 +17,37 @@
namespace arc {
+namespace {
+
+// A fake ArcBridgeBootstrap that creates a local connection.
+class FakeArcBridgeBootstrap : public ArcBridgeBootstrap {
+ public:
+ explicit FakeArcBridgeBootstrap(FakeArcBridgeInstance* instance)
+ : instance_(instance) {}
+ ~FakeArcBridgeBootstrap() override {}
+
+ void Start() override {
+ DCHECK(delegate_);
+ ArcBridgeInstancePtr instance;
+ instance_->Bind(mojo::GetProxy(&instance));
+ delegate_->OnConnectionEstablished(std::move(instance));
+ }
+
+ void Stop() override {
+ DCHECK(delegate_);
+ instance_->Unbind();
+ delegate_->OnStopped();
+ }
+
+ private:
+ // Owned by the caller.
+ FakeArcBridgeInstance* instance_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeBootstrap);
+};
+
+} // namespace
+
class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
public:
ArcBridgeTest() : ready_(false) {}
diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc
index bc54994..10388a2 100644
--- a/components/arc/arc_service_manager.cc
+++ b/components/arc/arc_service_manager.cc
@@ -24,23 +24,14 @@ namespace {
// Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos.
ArcServiceManager* g_arc_service_manager = nullptr;
-// This pointer is owned by ArcServiceManager.
-ArcBridgeService* g_arc_bridge_service_for_testing = nullptr;
-
} // namespace
-ArcServiceManager::ArcServiceManager() {
+ArcServiceManager::ArcServiceManager()
+ : arc_bridge_service_(
+ new ArcBridgeServiceImpl(ArcBridgeBootstrap::Create())) {
DCHECK(!g_arc_service_manager);
g_arc_service_manager = this;
- if (g_arc_bridge_service_for_testing) {
- arc_bridge_service_.reset(g_arc_bridge_service_for_testing);
- g_arc_bridge_service_for_testing = nullptr;
- } else {
- arc_bridge_service_.reset(new ArcBridgeServiceImpl(
- ArcBridgeBootstrap::Create()));
- }
-
AddService(make_scoped_ptr(new ArcClipboardBridge(arc_bridge_service())));
AddService(
make_scoped_ptr(new ArcCrashCollectorBridge(arc_bridge_service())));
@@ -55,9 +46,6 @@ ArcServiceManager::~ArcServiceManager() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(g_arc_service_manager == this);
g_arc_service_manager = nullptr;
- if (g_arc_bridge_service_for_testing) {
- delete g_arc_bridge_service_for_testing;
- }
}
// static
@@ -86,13 +74,4 @@ void ArcServiceManager::OnPrimaryUserProfilePrepared(
new ArcNotificationManager(arc_bridge_service(), account_id)));
}
-//static
-void ArcServiceManager::SetArcBridgeServiceForTesting(
- scoped_ptr<ArcBridgeService> arc_bridge_service) {
- if (g_arc_bridge_service_for_testing) {
- delete g_arc_bridge_service_for_testing;
- }
- g_arc_bridge_service_for_testing = arc_bridge_service.release();
-}
-
} // namespace arc
diff --git a/components/arc/arc_service_manager.h b/components/arc/arc_service_manager.h
index 5c36f56..b3a1a6d 100644
--- a/components/arc/arc_service_manager.h
+++ b/components/arc/arc_service_manager.h
@@ -38,10 +38,6 @@ class ArcServiceManager {
// Called when the main profile is initialized after user logs in.
void OnPrimaryUserProfilePrepared(const AccountId& account_id);
- // Set ArcBridgeService instance for testing. Call before ArcServiceManager
- // creation. ArcServiceManager owns |arc_bridge_service|.
- static void SetArcBridgeServiceForTesting(
- scoped_ptr<ArcBridgeService> arc_bridge_service);
private:
base::ThreadChecker thread_checker_;
scoped_ptr<ArcBridgeService> arc_bridge_service_;
diff --git a/components/arc/test/fake_arc_bridge_bootstrap.cc b/components/arc/test/fake_arc_bridge_bootstrap.cc
deleted file mode 100644
index d2d80bd..0000000
--- a/components/arc/test/fake_arc_bridge_bootstrap.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2016 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 "components/arc/test/fake_arc_bridge_bootstrap.h"
-
-#include <utility>
-
-#include "base/logging.h"
-#include "components/arc/common/arc_bridge.mojom.h"
-#include "components/arc/test/fake_arc_bridge_instance.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-
-namespace arc {
-
-FakeArcBridgeBootstrap::FakeArcBridgeBootstrap(FakeArcBridgeInstance* instance)
- : instance_(instance) {
-}
-
-void FakeArcBridgeBootstrap::Start() {
- DCHECK(delegate_);
- ArcBridgeInstancePtr instance;
- instance_->Bind(mojo::GetProxy(&instance));
- delegate_->OnConnectionEstablished(std::move(instance));
-}
-
-void FakeArcBridgeBootstrap::Stop() {
- DCHECK(delegate_);
- instance_->Unbind();
- delegate_->OnStopped();
-}
-
-} // namespace arc
diff --git a/components/arc/test/fake_arc_bridge_bootstrap.h b/components/arc/test/fake_arc_bridge_bootstrap.h
deleted file mode 100644
index feb7d6c..0000000
--- a/components/arc/test/fake_arc_bridge_bootstrap.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_BOOTSTRAP_H_
-#define COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_BOOTSTRAP_H_
-
-#include "base/macros.h"
-#include "components/arc/arc_bridge_bootstrap.h"
-
-namespace arc {
-
-class FakeArcBridgeInstance;
-
-// A fake ArcBridgeBootstrap that creates a local connection.
-class FakeArcBridgeBootstrap : public ArcBridgeBootstrap {
- public:
- explicit FakeArcBridgeBootstrap(FakeArcBridgeInstance* instance);
- ~FakeArcBridgeBootstrap() override {}
-
- // ArcBridgeBootstrap:
- void Start() override;
- void Stop() override;
-
- private:
- // Owned by the caller.
- FakeArcBridgeInstance* instance_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeArcBridgeBootstrap);
-};
-
-} // namespace arc
-
-#endif // COMPONENTS_ARC_TEST_FAKE_ARC_BRIDGE_BOOTSTRAP_H_