Flutter Engine
thread_unittests.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 #include "flutter/fml/thread.h"
6 
7 #include "gtest/gtest.h"
8 
9 TEST(Thread, CanStartAndEnd) {
10  fml::Thread thread;
11  ASSERT_TRUE(thread.GetTaskRunner());
12 }
13 
14 TEST(Thread, CanStartAndEndWithExplicitJoin) {
15  fml::Thread thread;
16  ASSERT_TRUE(thread.GetTaskRunner());
17  thread.Join();
18 }
19 
20 TEST(Thread, HasARunningMessageLoop) {
21  fml::Thread thread;
22  bool done = false;
23  thread.GetTaskRunner()->PostTask([&done]() { done = true; });
24  thread.Join();
25  ASSERT_TRUE(done);
26 }
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
Definition: thread.cc:45
virtual void PostTask(const fml::closure &task)
Definition: task_runner.cc:24
TEST(Thread, CanStartAndEnd)
void Join()
Definition: thread.cc:49