ash_unittests.cc 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (c) 2011 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 "ash/test/ash_test_suite.h"
  5. #include "base/bind.h"
  6. #include "base/message_loop/message_pump_type.h"
  7. #include "base/test/launcher/unit_test_launcher.h"
  8. #include "base/threading/thread.h"
  9. #include "components/viz/test/test_gpu_service_holder.h"
  10. #include "mojo/core/embedder/embedder.h"
  11. #include "mojo/core/embedder/scoped_ipc_support.h"
  12. namespace ash {
  13. // A significant number of ash_unittests are overriding the feature list after
  14. // the GPU thread is started so allowlist the whole test binary.
  15. // TODO(crbug.com/1241161): Fix racy tests and remove this.
  16. class AshScopedAllowRacyFeatureListOverrides {
  17. private:
  18. viz::TestGpuServiceHolder::ScopedAllowRacyFeatureListOverrides
  19. gpu_thread_allow_racy_overrides_;
  20. };
  21. } // namespace ash
  22. int main(int argc, char** argv) {
  23. ash::AshScopedAllowRacyFeatureListOverrides gpu_thread_allow_racy_overrides;
  24. ash::AshTestSuite test_suite(argc, argv);
  25. mojo::core::Init();
  26. // The IPC thread is necessary for the window service.
  27. base::Thread ipc_thread("IPC thread");
  28. ipc_thread.StartWithOptions(
  29. base::Thread::Options(base::MessagePumpType::IO, 0));
  30. mojo::core::ScopedIPCSupport ipc_support(
  31. ipc_thread.task_runner(),
  32. mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN);
  33. return base::LaunchUnitTests(
  34. argc, argv,
  35. base::BindOnce(&ash::AshTestSuite::Run, base::Unretained(&test_suite)));
  36. }