• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "gtest/gtest.h"
6 
7 #include "flutter/fml/thread.h"
8 
TEST(Thread,CanStartAndEnd)9 TEST(Thread, CanStartAndEnd) {
10   fml::Thread thread;
11   ASSERT_TRUE(thread.GetTaskRunner());
12 }
13 
TEST(Thread,CanStartAndEndWithExplicitJoin)14 TEST(Thread, CanStartAndEndWithExplicitJoin) {
15   fml::Thread thread;
16   ASSERT_TRUE(thread.GetTaskRunner());
17   thread.Join();
18 }
19 
TEST(Thread,HasARunningMessageLoop)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 }
27