Flutter Engine
The 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
9namespace flutter {
10namespace testing {
11namespace {
12
13fml::RefPtr<fml::TaskRunner> GetDefaultTaskRunner() {
16}
17
18} // namespace
19
20ThreadTest::ThreadTest() : current_task_runner_(GetDefaultTaskRunner()) {}
21
23 return current_task_runner_;
24}
25
27 const std::string& name) {
28 auto thread = std::make_unique<fml::Thread>(name);
29 auto runner = thread->GetTaskRunner();
30 extra_threads_.emplace_back(std::move(thread));
31 return runner;
32}
33
34} // namespace testing
35} // 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(const 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 void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
Definition: message_loop.cc:56
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32