Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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...
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...
static void EnsureInitializedForCurrentThread()
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32