[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "base/at_exit.h" | ||||
6 | #include "base/command_line.h" | ||||
Carlos Caballero | dd8bf7b04 | 2019-07-30 14:14:15 | [diff] [blame] | 7 | #include "base/message_loop/message_pump_type.h" |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 8 | #include "base/test/test_timeouts.h" |
9 | #include "dbus/bus.h" | ||||
10 | #include "dbus/test_service.h" | ||||
11 | |||||
12 | int main(int argc, char** argv) { | ||||
13 | base::AtExitManager exit_manager; | ||||
avi | 9ab03720 | 2014-12-22 23:49:53 | [diff] [blame] | 14 | base::CommandLine::Init(argc, argv); |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 15 | TestTimeouts::Initialize(); |
16 | |||||
gab | 8504bff | 2016-07-21 13:42:57 | [diff] [blame] | 17 | base::Thread dbus_thread("D-Bus Thread"); |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 18 | base::Thread::Options thread_options; |
Carlos Caballero | dd8bf7b04 | 2019-07-30 14:14:15 | [diff] [blame] | 19 | thread_options.message_pump_type = base::MessagePumpType::IO; |
gab | 8504bff | 2016-07-21 13:42:57 | [diff] [blame] | 20 | CHECK(dbus_thread.StartWithOptions(thread_options)); |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 21 | |
22 | dbus::TestService::Options options; | ||||
gab | 8504bff | 2016-07-21 13:42:57 | [diff] [blame] | 23 | options.dbus_task_runner = dbus_thread.task_runner(); |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 24 | dbus::TestService* test_service = new dbus::TestService(options); |
25 | CHECK(test_service->StartService()); | ||||
Ryo Hashimoto | 3bbeb5c | 2018-08-13 04:58:39 | [diff] [blame] | 26 | test_service->WaitUntilServiceIsStarted(); |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 27 | CHECK(test_service->HasDBusThread()); |
[email protected] | 500456f | 2012-06-07 17:05:36 | [diff] [blame] | 28 | } |