test_server.cc 1.0 KB

1234567891011121314151617181920212223242526272829
  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. #include "base/at_exit.h"
  5. #include "base/command_line.h"
  6. #include "base/message_loop/message_pump_type.h"
  7. #include "base/test/test_timeouts.h"
  8. #include "base/time/time.h"
  9. #include "dbus/bus.h"
  10. #include "dbus/test_service.h"
  11. int main(int argc, char** argv) {
  12. base::AtExitManager exit_manager;
  13. base::CommandLine::Init(argc, argv);
  14. TestTimeouts::Initialize();
  15. base::Thread dbus_thread("D-Bus Thread");
  16. base::Thread::Options thread_options;
  17. thread_options.message_pump_type = base::MessagePumpType::IO;
  18. CHECK(dbus_thread.StartWithOptions(std::move(thread_options)));
  19. dbus::TestService::Options options;
  20. options.dbus_task_runner = dbus_thread.task_runner();
  21. dbus::TestService* test_service = new dbus::TestService(options);
  22. CHECK(test_service->StartService());
  23. test_service->WaitUntilServiceIsStarted();
  24. CHECK(test_service->HasDBusThread());
  25. }