flutter_flutter/testing/thread_test.cc
liyuqian 84bf72917c
Revert PRs to unblock David and Jim's work (#14088)
* Revert "Add flow test fixtures and tests (#13986)"

This reverts commit 620f5281b819f304e8e9e945222e26b17b087cc3.

* Revert "Dynamically determine whether to use offscreen surface based on need (#13976)"

This reverts commit a86ef946563b020108320bbfb974bf7343284fd3.
2019-12-03 12:02:37 -08:00

37 lines
958 B
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#define FML_USED_ON_EMBEDDER
#include "flutter/testing/thread_test.h"
namespace flutter {
namespace testing {
// |testing::Test|
void ThreadTest::SetUp() {
fml::MessageLoop::EnsureInitializedForCurrentThread();
current_task_runner_ = fml::MessageLoop::GetCurrent().GetTaskRunner();
}
// |testing::Test|
void ThreadTest::TearDown() {
current_task_runner_ = nullptr;
extra_threads_.clear();
}
fml::RefPtr<fml::TaskRunner> ThreadTest::GetCurrentTaskRunner() {
return current_task_runner_;
}
fml::RefPtr<fml::TaskRunner> ThreadTest::CreateNewThread(std::string name) {
auto thread = std::make_unique<fml::Thread>(name);
auto runner = thread->GetTaskRunner();
extra_threads_.emplace_back(std::move(thread));
return runner;
}
} // namespace testing
} // namespace flutter