OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/arc/arc_bridge_service.h" | 5 #include "components/arc/arc_bridge_service.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
10 #include "components/arc/common/arc_host_messages.h" | 10 #include "components/arc/common/arc_host_messages.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 private: | 80 private: |
81 void SetUp() override { | 81 void SetUp() override { |
82 chromeos::DBusThreadManager::Initialize(); | 82 chromeos::DBusThreadManager::Initialize(); |
83 | 83 |
84 ready_ = false; | 84 ready_ = false; |
85 | 85 |
86 ipc_thread_.reset(new base::Thread("IPC thread")); | 86 ipc_thread_.reset(new base::Thread("IPC thread")); |
87 ipc_thread_->StartWithOptions( | 87 ipc_thread_->StartWithOptions( |
88 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 88 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
89 service_.reset(new ArcBridgeService(ipc_thread_->task_runner(), | 89 service_.reset(new ArcBridgeServiceImpl(ipc_thread_->task_runner(), |
90 message_loop_.task_runner())); | 90 message_loop_.task_runner())); |
91 | 91 |
92 service_->AddObserver(this); | 92 service_->AddObserver(this); |
93 | 93 |
94 IPC::ChannelHandle handle(IPC::Channel::GenerateUniqueRandomChannelID()); | 94 IPC::ChannelHandle handle(IPC::Channel::GenerateUniqueRandomChannelID()); |
95 // Testing code does not do all the steps that are done by regular | 95 // Testing code does not do all the steps that are done by regular |
96 // connection. In particular, it does not need to create a directory for | 96 // connection. In particular, it does not need to create a directory for |
97 // the socket, so manually set the state to CONNECTING. | 97 // the socket, so manually set the state to CONNECTING. |
98 service_->SetState(ArcBridgeService::State::CONNECTING); | 98 service_->SetState(ArcBridgeService::State::CONNECTING); |
99 // Connect directly to the specified channel instead of going through | 99 // Connect directly to the specified channel instead of going through |
100 // D-Bus, since it is not available for tests. | 100 // D-Bus, since it is not available for tests. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 ASSERT_TRUE(state() == ArcBridgeService::State::STOPPING || | 175 ASSERT_TRUE(state() == ArcBridgeService::State::STOPPING || |
176 state() == ArcBridgeService::State::STOPPED); | 176 state() == ArcBridgeService::State::STOPPED); |
177 | 177 |
178 base::RunLoop run_loop; | 178 base::RunLoop run_loop; |
179 run_loop.Run(); | 179 run_loop.Run(); |
180 | 180 |
181 ASSERT_EQ(ArcBridgeService::State::STOPPED, state()); | 181 ASSERT_EQ(ArcBridgeService::State::STOPPED, state()); |
182 } | 182 } |
183 | 183 |
184 } // namespace arc | 184 } // namespace arc |
OLD | NEW |