Flutter Engine
thread_test.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 #define FML_USED_ON_EMBEDDER
6 
7 #include "flutter/testing/thread_test.h"
8 
9 namespace flutter {
10 namespace testing {
11 namespace {
12 
13 fml::RefPtr<fml::TaskRunner> GetDefaultTaskRunner() {
16 }
17 
18 } // namespace
19 
20 ThreadTest::ThreadTest() : current_task_runner_(GetDefaultTaskRunner()) {}
21 
23  return current_task_runner_;
24 }
25 
27  auto thread = std::make_unique<fml::Thread>(name);
28  auto runner = thread->GetTaskRunner();
29  extra_threads_.emplace_back(std::move(thread));
30  return runner;
31 }
32 
33 } // namespace testing
34 } // namespace flutter
fml::RefPtr< fml::TaskRunner > GetCurrentTaskRunner()
Get the task runner for the thread that the current unit-test is running on. This creates a message l...
Definition: thread_test.cc:22
fml::RefPtr< fml::TaskRunner > CreateNewThread(std::string name="")
Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test...
Definition: thread_test.cc:26
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
static void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
Definition: message_loop.cc:56
const char * name
Definition: fuchsia.cc:50