Put the testing lib in the flutter namespace. (flutter/engine#8661)
This commit is contained in:
@@ -29,11 +29,11 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
|
||||
ASSERT_TRUE(vm_ref);
|
||||
auto vm_data = vm_ref.GetVMData();
|
||||
ASSERT_TRUE(vm_data);
|
||||
TaskRunners task_runners(::testing::GetCurrentTestName(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner() //
|
||||
TaskRunners task_runners(GetCurrentTestName(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner() //
|
||||
);
|
||||
auto weak_isolate = DartIsolate::CreateRootIsolate(
|
||||
vm_data->GetSettings(), // settings
|
||||
@@ -62,11 +62,11 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
|
||||
ASSERT_TRUE(vm_ref);
|
||||
auto vm_data = vm_ref.GetVMData();
|
||||
ASSERT_TRUE(vm_data);
|
||||
TaskRunners task_runners(::testing::GetCurrentTestName(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner() //
|
||||
TaskRunners task_runners(GetCurrentTestName(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner(), //
|
||||
GetCurrentTaskRunner() //
|
||||
);
|
||||
auto weak_isolate = DartIsolate::CreateRootIsolate(
|
||||
vm_data->GetSettings(), // settings
|
||||
@@ -164,11 +164,11 @@ static void RunDartCodeInIsolate(DartVMRef& vm_ref,
|
||||
return;
|
||||
}
|
||||
|
||||
TaskRunners task_runners(::testing::GetCurrentTestName(), //
|
||||
task_runner, //
|
||||
task_runner, //
|
||||
task_runner, //
|
||||
task_runner //
|
||||
TaskRunners task_runners(GetCurrentTestName(), //
|
||||
task_runner, //
|
||||
task_runner, //
|
||||
task_runner, //
|
||||
task_runner //
|
||||
);
|
||||
|
||||
auto vm_data = vm_ref.GetVMData();
|
||||
@@ -206,8 +206,8 @@ static void RunDartCodeInIsolate(DartVMRef& vm_ref,
|
||||
}
|
||||
|
||||
if (!DartVM::IsRunningPrecompiledCode()) {
|
||||
auto kernel_file_path = fml::paths::JoinPaths(
|
||||
{::testing::GetFixturesPath(), "kernel_blob.bin"});
|
||||
auto kernel_file_path =
|
||||
fml::paths::JoinPaths({GetFixturesPath(), "kernel_blob.bin"});
|
||||
|
||||
if (!fml::IsFile(kernel_file_path)) {
|
||||
FML_LOG(ERROR) << "Could not locate kernel file.";
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
RuntimeTest::RuntimeTest()
|
||||
: native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {}
|
||||
: native_resolver_(std::make_shared<TestDartNativeResolver>()) {}
|
||||
|
||||
RuntimeTest::~RuntimeTest() = default;
|
||||
|
||||
@@ -69,8 +69,8 @@ Settings RuntimeTest::CreateSettingsForFixture() {
|
||||
|
||||
// |testing::ThreadTest|
|
||||
void RuntimeTest::SetUp() {
|
||||
assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false,
|
||||
fml::FilePermission::kRead);
|
||||
assets_dir_ =
|
||||
fml::OpenDirectory(GetFixturesPath(), false, fml::FilePermission::kRead);
|
||||
ThreadTest::SetUp();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class RuntimeTest : public ::testing::ThreadTest {
|
||||
class RuntimeTest : public ThreadTest {
|
||||
public:
|
||||
RuntimeTest();
|
||||
|
||||
@@ -34,7 +34,7 @@ class RuntimeTest : public ::testing::ThreadTest {
|
||||
|
||||
private:
|
||||
fml::UniqueFD assets_dir_;
|
||||
std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_;
|
||||
std::shared_ptr<TestDartNativeResolver> native_resolver_;
|
||||
|
||||
void SetSnapshotsAndAssets(Settings& settings);
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
ShellTest::ShellTest()
|
||||
: native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {}
|
||||
: native_resolver_(std::make_shared<TestDartNativeResolver>()) {}
|
||||
|
||||
ShellTest::~ShellTest() = default;
|
||||
|
||||
@@ -87,10 +87,10 @@ TaskRunners ShellTest::GetTaskRunnersForFixture() {
|
||||
// |testing::ThreadTest|
|
||||
void ShellTest::SetUp() {
|
||||
ThreadTest::SetUp();
|
||||
assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false,
|
||||
fml::FilePermission::kRead);
|
||||
assets_dir_ =
|
||||
fml::OpenDirectory(GetFixturesPath(), false, fml::FilePermission::kRead);
|
||||
thread_host_ = std::make_unique<ThreadHost>(
|
||||
"io.flutter.test." + ::testing::GetCurrentTestName() + ".",
|
||||
"io.flutter.test." + GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI |
|
||||
ThreadHost::Type::GPU);
|
||||
}
|
||||
@@ -107,5 +107,30 @@ void ShellTest::AddNativeCallback(std::string name,
|
||||
native_resolver_->AddNativeCallback(std::move(name), callback);
|
||||
}
|
||||
|
||||
ShellTestPlatformView::ShellTestPlatformView(PlatformView::Delegate& delegate,
|
||||
TaskRunners task_runners)
|
||||
: PlatformView(delegate, std::move(task_runners)) {}
|
||||
|
||||
ShellTestPlatformView::~ShellTestPlatformView() = default;
|
||||
|
||||
// |PlatformView|
|
||||
std::unique_ptr<Surface> ShellTestPlatformView::CreateRenderingSurface() {
|
||||
return std::make_unique<GPUSurfaceSoftware>(this);
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
sk_sp<SkSurface> ShellTestPlatformView::AcquireBackingStore(
|
||||
const SkISize& size) {
|
||||
SkImageInfo image_info = SkImageInfo::MakeN32Premul(
|
||||
size.width(), size.height(), SkColorSpace::MakeSRGB());
|
||||
return SkSurface::MakeRaster(image_info);
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
bool ShellTestPlatformView::PresentBackingStore(
|
||||
sk_sp<SkSurface> backing_store) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@@ -10,14 +10,16 @@
|
||||
#include "flutter/common/settings.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/shell/common/run_configuration.h"
|
||||
#include "flutter/shell/common/shell.h"
|
||||
#include "flutter/shell/common/thread_host.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_software.h"
|
||||
#include "flutter/testing/test_dart_native_resolver.h"
|
||||
#include "flutter/testing/thread_test.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class ShellTest : public ::testing::ThreadTest {
|
||||
class ShellTest : public ThreadTest {
|
||||
public:
|
||||
ShellTest();
|
||||
|
||||
@@ -38,12 +40,33 @@ class ShellTest : public ::testing::ThreadTest {
|
||||
|
||||
private:
|
||||
fml::UniqueFD assets_dir_;
|
||||
std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_;
|
||||
std::shared_ptr<TestDartNativeResolver> native_resolver_;
|
||||
std::unique_ptr<ThreadHost> thread_host_;
|
||||
|
||||
void SetSnapshotsAndAssets(Settings& settings);
|
||||
};
|
||||
|
||||
class ShellTestPlatformView : public PlatformView,
|
||||
public GPUSurfaceSoftwareDelegate {
|
||||
public:
|
||||
ShellTestPlatformView(PlatformView::Delegate& delegate,
|
||||
TaskRunners task_runners);
|
||||
|
||||
~ShellTestPlatformView() override;
|
||||
|
||||
private:
|
||||
// |PlatformView|
|
||||
std::unique_ptr<Surface> CreateRenderingSurface() override;
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
virtual sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) override;
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
virtual bool PresentBackingStore(sk_sp<SkSurface> backing_store) override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView);
|
||||
};
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
|
||||
@@ -14,43 +14,13 @@
|
||||
#include "flutter/fml/synchronization/waitable_event.h"
|
||||
#include "flutter/shell/common/platform_view.h"
|
||||
#include "flutter/shell/common/rasterizer.h"
|
||||
#include "flutter/shell/common/shell.h"
|
||||
#include "flutter/shell/common/shell_test.h"
|
||||
#include "flutter/shell/common/thread_host.h"
|
||||
#include "flutter/shell/gpu/gpu_surface_software.h"
|
||||
#include "flutter/testing/testing.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class TestPlatformView : public PlatformView,
|
||||
public GPUSurfaceSoftwareDelegate {
|
||||
public:
|
||||
TestPlatformView(PlatformView::Delegate& delegate, TaskRunners task_runners)
|
||||
: PlatformView(delegate, std::move(task_runners)) {}
|
||||
|
||||
private:
|
||||
// |PlatformView|
|
||||
std::unique_ptr<Surface> CreateRenderingSurface() override {
|
||||
return std::make_unique<GPUSurfaceSoftware>(this);
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
virtual sk_sp<SkSurface> AcquireBackingStore(const SkISize& size) override {
|
||||
SkImageInfo image_info = SkImageInfo::MakeN32Premul(
|
||||
size.width(), size.height(), SkColorSpace::MakeSRGB());
|
||||
return SkSurface::MakeRaster(image_info);
|
||||
}
|
||||
|
||||
// |GPUSurfaceSoftwareDelegate|
|
||||
virtual bool PresentBackingStore(sk_sp<SkSurface> backing_store) override {
|
||||
return true;
|
||||
}
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(TestPlatformView);
|
||||
};
|
||||
|
||||
static bool ValidateShell(Shell* shell) {
|
||||
if (!shell) {
|
||||
return false;
|
||||
@@ -90,8 +60,8 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) {
|
||||
auto shell = Shell::Create(
|
||||
std::move(task_runners), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -103,10 +73,9 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) {
|
||||
TEST_F(ShellTest, InitializeWithDifferentThreads) {
|
||||
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
|
||||
Settings settings = CreateSettingsForFixture();
|
||||
ThreadHost thread_host(
|
||||
"io.flutter.test." + ::testing::GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
|
||||
ThreadHost::Type::IO | ThreadHost::Type::UI);
|
||||
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::Platform | ThreadHost::Type::GPU |
|
||||
ThreadHost::Type::IO | ThreadHost::Type::UI);
|
||||
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
|
||||
thread_host.gpu_thread->GetTaskRunner(),
|
||||
thread_host.ui_thread->GetTaskRunner(),
|
||||
@@ -114,8 +83,8 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) {
|
||||
auto shell = Shell::Create(
|
||||
std::move(task_runners), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -129,17 +98,16 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) {
|
||||
TEST_F(ShellTest, InitializeWithSingleThread) {
|
||||
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
|
||||
Settings settings = CreateSettingsForFixture();
|
||||
ThreadHost thread_host(
|
||||
"io.flutter.test." + ::testing::GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::Platform);
|
||||
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::Platform);
|
||||
auto task_runner = thread_host.platform_thread->GetTaskRunner();
|
||||
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
|
||||
task_runner);
|
||||
auto shell = Shell::Create(
|
||||
std::move(task_runners), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -160,8 +128,8 @@ TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) {
|
||||
auto shell = Shell::Create(
|
||||
std::move(task_runners), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -177,7 +145,7 @@ TEST_F(ShellTest,
|
||||
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
|
||||
Settings settings = CreateSettingsForFixture();
|
||||
ThreadHost thread_host(
|
||||
"io.flutter.test." + ::testing::GetCurrentTestName() + ".",
|
||||
"io.flutter.test." + GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI);
|
||||
fml::MessageLoop::EnsureInitializedForCurrentThread();
|
||||
TaskRunners task_runners("test",
|
||||
@@ -188,8 +156,8 @@ TEST_F(ShellTest,
|
||||
auto shell = Shell::Create(
|
||||
std::move(task_runners), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -204,7 +172,7 @@ TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) {
|
||||
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
|
||||
Settings settings = CreateSettingsForFixture();
|
||||
ThreadHost thread_host(
|
||||
"io.flutter.test." + ::testing::GetCurrentTestName() + ".",
|
||||
"io.flutter.test." + GetCurrentTestName() + ".",
|
||||
ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI);
|
||||
TaskRunners task_runners(
|
||||
"test",
|
||||
@@ -216,8 +184,8 @@ TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) {
|
||||
auto shell = Shell::Create(
|
||||
std::move(task_runners), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -234,8 +202,8 @@ TEST_F(ShellTest, FixturesAreFunctional) {
|
||||
auto shell = Shell::Create(
|
||||
GetTaskRunnersForFixture(), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
@@ -274,8 +242,8 @@ TEST_F(ShellTest, SecondaryIsolateBindingsAreSetupViaShellSettings) {
|
||||
auto shell = Shell::Create(
|
||||
GetTaskRunnersForFixture(), settings,
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<TestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
return std::make_unique<ShellTestPlatformView>(shell,
|
||||
shell.GetTaskRunners());
|
||||
},
|
||||
[](Shell& shell) {
|
||||
return std::make_unique<Rasterizer>(shell.GetTaskRunners());
|
||||
|
||||
@@ -34,7 +34,7 @@ TEST_F(Embedder11yTest, A11yTreeIsConsistent) {
|
||||
})));
|
||||
|
||||
// Called by test fixture on UI thread to pass data back to this test.
|
||||
::testing::NativeEntry callback;
|
||||
NativeEntry callback;
|
||||
context.AddNativeCallback(
|
||||
"NotifyTestData",
|
||||
CREATE_NATIVE_ENTRY(([&callback](Dart_NativeArguments args) {
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace testing {
|
||||
|
||||
EmbedderContext::EmbedderContext(std::string assets_path)
|
||||
: assets_path_(std::move(assets_path)),
|
||||
native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {
|
||||
native_resolver_(std::make_shared<TestDartNativeResolver>()) {
|
||||
auto assets_dir = fml::OpenDirectory(assets_path_.c_str(), false,
|
||||
fml::FilePermission::kRead);
|
||||
vm_snapshot_data_ =
|
||||
@@ -27,8 +27,8 @@ EmbedderContext::EmbedderContext(std::string assets_path)
|
||||
}
|
||||
|
||||
isolate_create_callbacks_.push_back(
|
||||
[weak_resolver = std::weak_ptr<::testing::TestDartNativeResolver>{
|
||||
native_resolver_}]() {
|
||||
[weak_resolver =
|
||||
std::weak_ptr<TestDartNativeResolver>{native_resolver_}]() {
|
||||
if (auto resolver = weak_resolver.lock()) {
|
||||
resolver->SetNativeResolverForIsolate();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class EmbedderContext {
|
||||
std::unique_ptr<fml::Mapping> isolate_snapshot_data_;
|
||||
std::unique_ptr<fml::Mapping> isolate_snapshot_instructions_;
|
||||
std::vector<fml::closure> isolate_create_callbacks_;
|
||||
std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_;
|
||||
std::shared_ptr<TestDartNativeResolver> native_resolver_;
|
||||
SemanticsNodeCallback update_semantics_node_callback_;
|
||||
SemanticsActionCallback update_semantics_custom_action_callback_;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ EmbedderTest::EmbedderTest() = default;
|
||||
EmbedderTest::~EmbedderTest() = default;
|
||||
|
||||
std::string EmbedderTest::GetFixturesDirectory() const {
|
||||
return ::testing::GetFixturesPath();
|
||||
return GetFixturesPath();
|
||||
}
|
||||
|
||||
EmbedderContext& EmbedderTest::GetEmbedderContext() {
|
||||
|
||||
@@ -19,7 +19,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.fixtures_location_file, 'w') as file:
|
||||
file.write('namespace testing {const char* GetFixturesPath() {return "%s";}}'
|
||||
file.write('namespace flutter {namespace testing {const char* GetFixturesPath() {return "%s";}}}'
|
||||
% args.fixtures_location)
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "third_party/tonic/logging/dart_error.h"
|
||||
#include "tonic/converter/dart_converter.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
TestDartNativeResolver::TestDartNativeResolver() = default;
|
||||
@@ -89,3 +90,4 @@ void TestDartNativeResolver::SetNativeResolverForIsolate() {
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#define CREATE_NATIVE_ENTRY(native_entry) \
|
||||
([&]() { \
|
||||
static ::testing::NativeEntry closure; \
|
||||
static ::flutter::testing::NativeEntry closure; \
|
||||
static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \
|
||||
closure(args); \
|
||||
}; \
|
||||
@@ -22,6 +22,7 @@
|
||||
return entrypoint; \
|
||||
})()
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
using NativeEntry = std::function<void(Dart_NativeArguments)>;
|
||||
@@ -51,5 +52,6 @@ class TestDartNativeResolver
|
||||
};
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
|
||||
#include "testing.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
std::string GetCurrentTestName() {
|
||||
return UnitTest::GetInstance()->current_test_info()->name();
|
||||
return ::testing::UnitTest::GetInstance()->current_test_info()->name();
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
// Returns the directory containing the test fixture for the target if this
|
||||
@@ -19,5 +20,6 @@ const char* GetFixturesPath();
|
||||
std::string GetCurrentTestName();
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
#endif // TESTING_TESTING_H_
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "flutter/testing/thread_test.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
// |testing::Test|
|
||||
@@ -33,3 +34,4 @@ fml::RefPtr<fml::TaskRunner> ThreadTest::GetThreadTaskRunner() {
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
#include "flutter/fml/thread.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace flutter {
|
||||
namespace testing {
|
||||
|
||||
class ThreadTest : public Test {
|
||||
class ThreadTest : public ::testing::Test {
|
||||
public:
|
||||
fml::RefPtr<fml::TaskRunner> GetCurrentTaskRunner();
|
||||
|
||||
@@ -35,5 +36,6 @@ class ThreadTest : public Test {
|
||||
};
|
||||
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
#endif // FLUTTER_TESTING_THREAD_TEST_H_
|
||||
|
||||
Reference in New Issue
Block a user