| Index: base/task_scheduler/task_scheduler_impl_unittest.cc
|
| diff --git a/base/task_scheduler/task_scheduler_impl_unittest.cc b/base/task_scheduler/task_scheduler_impl_unittest.cc
|
| index bacedb7cf98747e75dc9f8987fe25b8e5027b026..1489baebe4f958f5d12477ac2dc9c19e6ed41376 100644
|
| --- a/base/task_scheduler/task_scheduler_impl_unittest.cc
|
| +++ b/base/task_scheduler/task_scheduler_impl_unittest.cc
|
| @@ -28,6 +28,10 @@
|
| #include "base/time/time.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +#if defined(OS_WIN)
|
| +#include <objbase.h>
|
| +#endif // defined(OS_WIN)
|
| +
|
| namespace base {
|
| namespace internal {
|
|
|
| @@ -366,5 +370,29 @@ TEST_F(TaskSchedulerImplTest, SingleThreadRunsTasksOnCurrentThread) {
|
| task_ran.Wait();
|
| }
|
|
|
| +#if defined(OS_WIN)
|
| +TEST_F(TaskSchedulerImplTest, COMSTATaskRunnersRunWithCOMSTA) {
|
| + auto com_sta_task_runner =
|
| + scheduler_->CreateCOMSTATaskRunnerWithTraits(TaskTraits());
|
| +
|
| + WaitableEvent task_ran(WaitableEvent::ResetPolicy::MANUAL,
|
| + WaitableEvent::InitialState::NOT_SIGNALED);
|
| + com_sta_task_runner->PostTask(
|
| + FROM_HERE,
|
| + Bind(
|
| + [](scoped_refptr<TaskRunner> single_thread_task_runner,
|
| + WaitableEvent* task_ran) {
|
| + HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
| + if (SUCCEEDED(hr)) {
|
| + ADD_FAILURE() << "COM STA was not initialized on this thread";
|
| + CoUninitialize();
|
| + }
|
| + task_ran->Signal();
|
| + },
|
| + com_sta_task_runner, Unretained(&task_ran)));
|
| + task_ran.Wait();
|
| +}
|
| +#endif // defined(OS_WIN)
|
| +
|
| } // namespace internal
|
| } // namespace base
|
|
|