Flutter Engine
The Flutter Engine
Functions
impeller::android::testing Namespace Reference

Functions

 TEST (ToolkitAndroidTest, CanCreateProcTable)
 
 TEST (ToolkitAndroidTest, GuardsAgainstZeroSizedDescriptors)
 
 TEST (ToolkitAndroidTest, CanCreateHardwareBuffer)
 
 TEST (ToolkitAndroidTest, CanGetHardwareBufferIDs)
 
 TEST (ToolkitAndroidTest, HardwareBufferNullIDIfAPIUnavailable)
 
 TEST (ToolkitAndroidTest, CanDescribeHardwareBufferHandles)
 
 TEST (ToolkitAndroidTest, CanApplySurfaceTransaction)
 
 TEST (ToolkitAndroidTest, SurfacControlsAreAvailable)
 
 TEST (ToolkitAndroidTest, ChoreographerIsAvailable)
 
 TEST (ToolkitAndroidTest, CanPostAndNotWaitForFrameCallbacks)
 
 TEST (ToolkitAndroidTest, CanPostAndWaitForFrameCallbacks)
 

Function Documentation

◆ TEST() [1/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanApplySurfaceTransaction   
)

Definition at line 84 of file toolkit_android_unittests.cc.

84 {
85 if (!SurfaceTransaction::IsAvailableOnPlatform()) {
86 GTEST_SKIP() << "Surface controls are not supported on this platform.";
87 }
88 ASSERT_TRUE(SurfaceTransaction::IsAvailableOnPlatform());
89 SurfaceTransaction transaction;
90 ASSERT_TRUE(transaction.IsValid());
92 ASSERT_TRUE(transaction.Apply([&event](auto) { event.Signal(); }));
93 event.Wait();
94}
A wrapper for ASurfaceTransaction. https://developer.android.com/ndk/reference/group/native-activity#...
bool Apply(OnCompleteCallback callback=nullptr)
Applies the updated encoded in the transaction and invokes the callback when the updated are complete...
FlKeyEvent * event

◆ TEST() [2/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanCreateHardwareBuffer   
)

Definition at line 38 of file toolkit_android_unittests.cc.

38 {
39 if (!HardwareBuffer::IsAvailableOnPlatform()) {
40 GTEST_SKIP() << "Hardware buffers are not supported on this platform.";
41 }
42 ASSERT_TRUE(HardwareBuffer::IsAvailableOnPlatform());
43 auto desc = HardwareBufferDescriptor::MakeForSwapchainImage({100, 100});
44 ASSERT_TRUE(desc.IsAllocatable());
45 HardwareBuffer buffer(desc);
46 ASSERT_TRUE(buffer.IsValid());
47}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ TEST() [3/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanCreateProcTable   
)

Definition at line 27 of file toolkit_android_unittests.cc.

27 {
28 ProcTable proc_table;
29 ASSERT_TRUE(proc_table.IsValid());
30}
The table of Android procs that are resolved dynamically.
Definition: proc_table.h:94
bool IsValid() const
If a valid proc table could be setup. This may fail in case of setup on non-Android platforms.
Definition: proc_table.cc:65

◆ TEST() [4/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanDescribeHardwareBufferHandles   
)

Definition at line 69 of file toolkit_android_unittests.cc.

69 {
70 if (!HardwareBuffer::IsAvailableOnPlatform()) {
71 GTEST_SKIP() << "Hardware buffers are not supported on this platform.";
72 }
73 ASSERT_TRUE(HardwareBuffer::IsAvailableOnPlatform());
74 auto desc = HardwareBufferDescriptor::MakeForSwapchainImage({100, 100});
75 ASSERT_TRUE(desc.IsAllocatable());
76 HardwareBuffer buffer(desc);
77 ASSERT_TRUE(buffer.IsValid());
78 auto a_desc = HardwareBuffer::Describe(buffer.GetHandle());
79 ASSERT_TRUE(a_desc.has_value());
80 ASSERT_EQ(a_desc->width, 100u); // NOLINT
81 ASSERT_EQ(a_desc->height, 100u); // NOLINT
82}

◆ TEST() [5/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanGetHardwareBufferIDs   
)

Definition at line 49 of file toolkit_android_unittests.cc.

49 {
50 if (!HardwareBuffer::IsAvailableOnPlatform()) {
51 GTEST_SKIP() << "Hardware buffers are not supported on this platform.";
52 }
53 ASSERT_TRUE(HardwareBuffer::IsAvailableOnPlatform());
54 if (!GetProcTable().AHardwareBuffer_getId.IsAvailable()) {
55 GTEST_SKIP() << "Hardware buffer IDs are not available on this platform.";
56 }
57 auto desc = HardwareBufferDescriptor::MakeForSwapchainImage({100, 100});
58 ASSERT_TRUE(desc.IsAllocatable());
59 HardwareBuffer buffer(desc);
60 ASSERT_TRUE(buffer.IsValid());
61 ASSERT_TRUE(buffer.GetSystemUniqueID().has_value());
62}
const ProcTable & GetProcTable()
Definition: proc_table.cc:12

◆ TEST() [6/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanPostAndNotWaitForFrameCallbacks   
)

Definition at line 110 of file toolkit_android_unittests.cc.

110 {
111 if (!Choreographer::IsAvailableOnPlatform()) {
112 GTEST_SKIP() << "Choreographer is not supported on this platform.";
113 }
114 const auto& choreographer = Choreographer::GetInstance();
115 ASSERT_TRUE(choreographer.IsValid());
116 ASSERT_TRUE(choreographer.PostFrameCallback([](auto) {}));
117}

◆ TEST() [7/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
CanPostAndWaitForFrameCallbacks   
)

Definition at line 119 of file toolkit_android_unittests.cc.

119 {
120 if (!Choreographer::IsAvailableOnPlatform()) {
121 GTEST_SKIP() << "Choreographer is not supported on this platform.";
122 }
123 if ((true)) {
124 GTEST_SKIP()
125 << "Disabled till the test harness is in an Android activity. "
126 "Running it without one will hang because the choreographer "
127 "frame callback will never execute.";
128 }
129 const auto& choreographer = Choreographer::GetInstance();
130 ASSERT_TRUE(choreographer.IsValid());
132 ASSERT_TRUE(choreographer.PostFrameCallback(
133 [&event](auto point) { event.Signal(); }));
134 event.Wait();
135}

◆ TEST() [8/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
ChoreographerIsAvailable   
)

Definition at line 103 of file toolkit_android_unittests.cc.

103 {
104 if (!Choreographer::IsAvailableOnPlatform()) {
105 GTEST_SKIP() << "Choreographer is not supported on this platform.";
106 }
107 ASSERT_TRUE(Choreographer::IsAvailableOnPlatform());
108}

◆ TEST() [9/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
GuardsAgainstZeroSizedDescriptors   
)

Definition at line 32 of file toolkit_android_unittests.cc.

32 {
33 auto desc = HardwareBufferDescriptor::MakeForSwapchainImage({0, 0});
34 ASSERT_GT(desc.size.width, 0u);
35 ASSERT_GT(desc.size.height, 0u);
36}

◆ TEST() [10/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
HardwareBufferNullIDIfAPIUnavailable   
)

Definition at line 64 of file toolkit_android_unittests.cc.

64 {
65 DISABLE_ANDROID_PROC(AHardwareBuffer_getId);
66 ASSERT_FALSE(HardwareBuffer::GetSystemUniqueID(nullptr).has_value());
67}
#define DISABLE_ANDROID_PROC(name)

◆ TEST() [11/11]

impeller::android::testing::TEST ( ToolkitAndroidTest  ,
SurfacControlsAreAvailable   
)

Definition at line 96 of file toolkit_android_unittests.cc.

96 {
97 if (!SurfaceControl::IsAvailableOnPlatform()) {
98 GTEST_SKIP() << "Surface controls are not supported on this platform.";
99 }
100 ASSERT_TRUE(SurfaceControl::IsAvailableOnPlatform());
101}