Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
flutter::testing::ShellTest Class Reference

#include <shell_test.h>

Inheritance diagram for flutter::testing::ShellTest:
flutter::testing::FixtureTest flutter::testing::DartFixture flutter::testing::ThreadTest flutter::testing::FuchsiaShellTest flutter::testing::ImageDisposeTest flutter::testing::PlatformConfigurationTest

Classes

struct  Config
 

Public Types

enum  ServiceProtocolEnum {
  kGetSkSLs , kEstimateRasterCacheMemory , kSetAssetBundlePath , kRunInView ,
  kRenderFrameWithRasterStats
}
 

Public Member Functions

 ShellTest ()
 
Settings CreateSettingsForFixture () override
 
std::unique_ptr< ShellCreateShell (const Settings &settings, std::optional< TaskRunners > task_runners={})
 
std::unique_ptr< ShellCreateShell (const Config &config)
 
void DestroyShell (std::unique_ptr< Shell > shell)
 
void DestroyShell (std::unique_ptr< Shell > shell, const TaskRunners &task_runners)
 
TaskRunners GetTaskRunnersForFixture ()
 
fml::TimePoint GetLatestFrameTargetTime (Shell *shell) const
 
void SendPlatformMessage (Shell *shell, std::unique_ptr< PlatformMessage > message)
 
void SendEnginePlatformMessage (Shell *shell, std::unique_ptr< PlatformMessage > message)
 
std::shared_ptr< txt::FontCollectionGetFontCollection (Shell *shell)
 
- Public Member Functions inherited from flutter::testing::FixtureTest
 FixtureTest ()
 
 FixtureTest (std::string kernel_filename, std::string elf_filename, std::string elf_split_filename)
 
- Public Member Functions inherited from flutter::testing::DartFixture
 DartFixture ()
 
 DartFixture (std::string kernel_filename, std::string elf_filename, std::string elf_split_filename)
 
virtual Settings CreateSettingsForFixture ()
 
void AddNativeCallback (const std::string &name, Dart_NativeFunction callback)
 
void AddFfiNativeCallback (const std::string &name, void *callback_ptr)
 
- Public Member Functions inherited from flutter::testing::ThreadTest
 ThreadTest ()
 
fml::RefPtr< fml::TaskRunnerGetCurrentTaskRunner ()
 Get the task runner for the thread that the current unit-test is running on. This creates a message loop as necessary. More...
 
fml::RefPtr< fml::TaskRunnerCreateNewThread (const std::string &name="")
 Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test. The message loop is terminated (and its thread joined) when the test ends. This allows tests to create multiple named threads as necessary. More...
 

Static Public Member Functions

static void PlatformViewNotifyCreated (Shell *shell)
 
static void PlatformViewNotifyDestroyed (Shell *shell)
 
static void RunEngine (Shell *shell, RunConfiguration configuration)
 
static void RestartEngine (Shell *shell, RunConfiguration configuration)
 
static void VSyncFlush (Shell *shell, bool *will_draw_new_frame=nullptr)
 
static void SetViewportMetrics (Shell *shell, double width, double height)
 
static void NotifyIdle (Shell *shell, fml::TimeDelta deadline)
 
static void PumpOneFrame (Shell *shell)
 
static void PumpOneFrame (Shell *shell, FrameContent frame_content)
 
static void DispatchFakePointerData (Shell *shell, double x)
 
static void DispatchPointerData (Shell *shell, std::unique_ptr< PointerDataPacket > packet)
 
static bool GetNeedsReportTimings (Shell *shell)
 
static void SetNeedsReportTimings (Shell *shell, bool value)
 
static void StorePersistentCache (PersistentCache *cache, const SkData &key, const SkData &value)
 
static bool IsAnimatorRunning (Shell *shell)
 
static void OnServiceProtocol (Shell *shell, ServiceProtocolEnum some_protocol, const fml::RefPtr< fml::TaskRunner > &task_runner, const ServiceProtocol::Handler::ServiceProtocolMap &params, rapidjson::Document *response)
 
static int UnreportedTimingsCount (Shell *shell)
 
static size_t GetLiveTrackedPathCount (const std::shared_ptr< VolatilePathTracker > &tracker)
 
static void TurnOffGPU (Shell *shell, bool value)
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::testing::DartFixture
void SetSnapshotsAndAssets (Settings &settings)
 
- Protected Attributes inherited from flutter::testing::DartFixture
std::shared_ptr< TestDartNativeResolvernative_resolver_
 
ELFAOTSymbols split_aot_symbols_
 
std::string kernel_filename_
 
std::string elf_filename_
 
fml::UniqueFD assets_dir_
 
ELFAOTSymbols aot_symbols_
 

Detailed Description

Definition at line 64 of file shell_test.h.

Member Enumeration Documentation

◆ ServiceProtocolEnum

Enumerator
kGetSkSLs 
kEstimateRasterCacheMemory 
kSetAssetBundlePath 
kRunInView 
kRenderFrameWithRasterStats 

Definition at line 134 of file shell_test.h.

Constructor & Destructor Documentation

◆ ShellTest()

flutter::testing::ShellTest::ShellTest ( )

Definition at line 58 of file shell_test.cc.

59 : thread_host_("io.flutter.test." + GetCurrentTestName() + ".",
60 ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
61 ThreadHost::Type::kUi | ThreadHost::Type::kRaster) {}
@ kRaster
Suitable for thread which raster data.
Definition: embedder.h:266
std::string GetCurrentTestName()
Gets the name of the currently running test. This is useful in generating logs or assets based on tes...
Definition: testing.cc:15

Member Function Documentation

◆ CreateSettingsForFixture()

Settings flutter::testing::ShellTest::CreateSettingsForFixture ( )
overridevirtual

Reimplemented from flutter::testing::DartFixture.

Definition at line 336 of file shell_test.cc.

336 {
337 Settings settings;
338 settings.leak_vm = false;
339 settings.task_observer_add = [](intptr_t key, const fml::closure& handler) {
341 };
342 settings.task_observer_remove = [](intptr_t key) {
344 };
345 settings.isolate_create_callback = [this]() {
346 native_resolver_->SetNativeResolverForIsolate();
347 };
348#if OS_FUCHSIA
349 settings.verbose_logging = true;
350#endif
352 return settings;
353}
void SetSnapshotsAndAssets(Settings &settings)
Definition: dart_fixture.cc:43
std::shared_ptr< TestDartNativeResolver > native_resolver_
Definition: dart_fixture.h:37
void RemoveTaskObserver(intptr_t key)
Definition: message_loop.cc:68
void AddTaskObserver(intptr_t key, const fml::closure &callback)
Definition: message_loop.cc:64
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
std::function< void()> closure
Definition: closure.h:14

◆ CreateShell() [1/2]

std::unique_ptr< Shell > flutter::testing::ShellTest::CreateShell ( const Config config)

Definition at line 378 of file shell_test.cc.

378 {
379 TaskRunners task_runners = config.task_runners.has_value()
380 ? config.task_runners.value()
382 Shell::CreateCallback<PlatformView> platform_view_create_callback =
383 config.platform_view_create_callback;
384 if (!platform_view_create_callback) {
385 platform_view_create_callback = ShellTestPlatformViewBuilder({});
386 }
387
388 Shell::CreateCallback<Rasterizer> rasterizer_create_callback =
389 [](Shell& shell) { return std::make_unique<Rasterizer>(shell); };
390
392 task_runners, //
393 config.settings, //
394 platform_view_create_callback, //
395 rasterizer_create_callback, //
396 config.is_gpu_disabled //
397 );
398}
static std::unique_ptr< Shell > Create(const PlatformData &platform_data, const TaskRunners &task_runners, Settings settings, const CreateCallback< PlatformView > &on_create_platform_view, const CreateCallback< Rasterizer > &on_create_rasterizer, bool is_gpu_disabled=false)
Creates a shell instance using the provided settings. The callbacks to create the various shell subco...
Definition: shell.cc:169
TaskRunners GetTaskRunnersForFixture()
Definition: shell_test.cc:355

◆ CreateShell() [2/2]

std::unique_ptr< Shell > flutter::testing::ShellTest::CreateShell ( const Settings settings,
std::optional< TaskRunners task_runners = {} 
)

Definition at line 369 of file shell_test.cc.

371 {
372 return CreateShell({
373 .settings = settings,
374 .task_runners = std::move(task_runners),
375 });
376}
std::unique_ptr< Shell > CreateShell(const Settings &settings, std::optional< TaskRunners > task_runners={})
Definition: shell_test.cc:369

◆ DestroyShell() [1/2]

void flutter::testing::ShellTest::DestroyShell ( std::unique_ptr< Shell shell)

Definition at line 400 of file shell_test.cc.

400 {
402}
void DestroyShell(std::unique_ptr< Shell > shell)
Definition: shell_test.cc:400

◆ DestroyShell() [2/2]

void flutter::testing::ShellTest::DestroyShell ( std::unique_ptr< Shell shell,
const TaskRunners task_runners 
)

Definition at line 404 of file shell_test.cc.

405 {
407 fml::TaskRunner::RunNowOrPostTask(task_runners.GetPlatformTaskRunner(),
408 [&shell, &latch]() mutable {
409 shell.reset();
410 latch.Signal();
411 });
412 latch.Wait();
413}
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
Definition: task_runner.cc:55

◆ DispatchFakePointerData()

void flutter::testing::ShellTest::DispatchFakePointerData ( Shell shell,
double  x 
)
static

Definition at line 261 of file shell_test.cc.

261 {
262 auto packet = std::make_unique<PointerDataPacket>(1);
263 packet->SetPointerData(0, PointerData{
265 .physical_x = x,
266 });
267 DispatchPointerData(shell, std::move(packet));
268}
static void DispatchPointerData(Shell *shell, std::unique_ptr< PointerDataPacket > packet)
Definition: shell_test.cc:270
double x

◆ DispatchPointerData()

void flutter::testing::ShellTest::DispatchPointerData ( Shell shell,
std::unique_ptr< PointerDataPacket packet 
)
static

Definition at line 270 of file shell_test.cc.

271 {
273 shell->GetTaskRunners().GetPlatformTaskRunner()->PostTask(
274 [&latch, shell, &packet]() {
275 // Goes through PlatformView to ensure packet is corrected converted.
276 shell->GetPlatformView()->DispatchPointerDataPacket(std::move(packet));
277 latch.Signal();
278 });
279 latch.Wait();
280}
static void DispatchPointerDataPacket(JNIEnv *env, jobject jcaller, jlong shell_holder, jobject buffer, jint position)

◆ GetFontCollection()

std::shared_ptr< txt::FontCollection > flutter::testing::ShellTest::GetFontCollection ( Shell shell)

Definition at line 331 of file shell_test.cc.

332 {
333 return shell->weak_engine_->GetFontCollection().GetFontCollection();
334}

◆ GetLatestFrameTargetTime()

fml::TimePoint flutter::testing::ShellTest::GetLatestFrameTargetTime ( Shell shell) const

Definition at line 365 of file shell_test.cc.

365 {
366 return shell->GetLatestFrameTargetTime();
367}

◆ GetLiveTrackedPathCount()

size_t flutter::testing::ShellTest::GetLiveTrackedPathCount ( const std::shared_ptr< VolatilePathTracker > &  tracker)
static

Definition at line 415 of file shell_test.cc.

416 {
417 return std::count_if(
418 tracker->paths_.begin(), tracker->paths_.end(),
419 [](const std::weak_ptr<VolatilePathTracker::TrackedPath>& path) {
420 return path.lock();
421 });
422}
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
Definition: switches.h:57

◆ GetNeedsReportTimings()

bool flutter::testing::ShellTest::GetNeedsReportTimings ( Shell shell)
static

Definition at line 290 of file shell_test.cc.

290 {
291 return shell->needs_report_timings_;
292}

◆ GetTaskRunnersForFixture()

TaskRunners flutter::testing::ShellTest::GetTaskRunnersForFixture ( )

Definition at line 355 of file shell_test.cc.

355 {
356 return {
357 "test",
358 thread_host_.platform_thread->GetTaskRunner(), // platform
359 thread_host_.raster_thread->GetTaskRunner(), // raster
360 thread_host_.ui_thread->GetTaskRunner(), // ui
361 thread_host_.io_thread->GetTaskRunner() // io
362 };
363}
std::unique_ptr< fml::Thread > io_thread
Definition: thread_host.h:86
std::unique_ptr< fml::Thread > platform_thread
Definition: thread_host.h:83
std::unique_ptr< fml::Thread > raster_thread
Definition: thread_host.h:85
std::unique_ptr< fml::Thread > ui_thread
Definition: thread_host.h:84

◆ IsAnimatorRunning()

static bool flutter::testing::ShellTest::IsAnimatorRunning ( Shell shell)
static

◆ NotifyIdle()

void flutter::testing::ShellTest::NotifyIdle ( Shell shell,
fml::TimeDelta  deadline 
)
static

Definition at line 199 of file shell_test.cc.

199 {
201 shell->GetTaskRunners().GetUITaskRunner()->PostTask(
202 [&latch, engine = shell->weak_engine_, deadline]() {
203 if (engine) {
204 engine->NotifyIdle(deadline);
205 }
206 latch.Signal();
207 });
208 latch.Wait();
209}
FlutterEngine engine
Definition: main.cc:68

◆ OnServiceProtocol()

void flutter::testing::ShellTest::OnServiceProtocol ( Shell shell,
ServiceProtocolEnum  some_protocol,
const fml::RefPtr< fml::TaskRunner > &  task_runner,
const ServiceProtocol::Handler::ServiceProtocolMap params,
rapidjson::Document *  response 
)
static

Definition at line 300 of file shell_test.cc.

305 {
306 std::promise<bool> finished;
307 fml::TaskRunner::RunNowOrPostTask(task_runner, [shell, some_protocol, params,
308 response, &finished]() {
309 switch (some_protocol) {
310 case ServiceProtocolEnum::kGetSkSLs:
311 shell->OnServiceProtocolGetSkSLs(params, response);
312 break;
313 case ServiceProtocolEnum::kEstimateRasterCacheMemory:
314 shell->OnServiceProtocolEstimateRasterCacheMemory(params, response);
315 break;
316 case ServiceProtocolEnum::kSetAssetBundlePath:
317 shell->OnServiceProtocolSetAssetBundlePath(params, response);
318 break;
319 case ServiceProtocolEnum::kRunInView:
320 shell->OnServiceProtocolRunInView(params, response);
321 break;
322 case ServiceProtocolEnum::kRenderFrameWithRasterStats:
323 shell->OnServiceProtocolRenderFrameWithRasterStats(params, response);
324 break;
325 }
326 finished.set_value(true);
327 });
328 finished.get_future().wait();
329}
const EmbeddedViewParams * params

◆ PlatformViewNotifyCreated()

void flutter::testing::ShellTest::PlatformViewNotifyCreated ( Shell shell)
static

Definition at line 84 of file shell_test.cc.

84 {
87 shell->GetTaskRunners().GetPlatformTaskRunner(), [shell, &latch]() {
88 shell->GetPlatformView()->NotifyCreated();
89 latch.Signal();
90 });
91 latch.Wait();
92}

◆ PlatformViewNotifyDestroyed()

void flutter::testing::ShellTest::PlatformViewNotifyDestroyed ( Shell shell)
static

Definition at line 94 of file shell_test.cc.

94 {
97 shell->GetTaskRunners().GetPlatformTaskRunner(), [shell, &latch]() {
98 shell->GetPlatformView()->NotifyDestroyed();
99 latch.Signal();
100 });
101 latch.Wait();
102}

◆ PumpOneFrame() [1/2]

void flutter::testing::ShellTest::PumpOneFrame ( Shell shell)
static

Definition at line 211 of file shell_test.cc.

211 {
213}
static void PumpOneFrame(Shell *shell)
Definition: shell_test.cc:211
static FrameContent DummyView(double width=1, double height=1)
Definition: shell_test.cc:29

◆ PumpOneFrame() [2/2]

void flutter::testing::ShellTest::PumpOneFrame ( Shell shell,
FrameContent  frame_content 
)
static

Definition at line 215 of file shell_test.cc.

215 {
216 // Set viewport to nonempty, and call Animator::BeginFrame to make the layer
217 // tree pipeline nonempty. Without either of this, the layer tree below
218 // won't be rasterized.
220 fml::WeakPtr<RuntimeDelegate> runtime_delegate = shell->weak_engine_;
221 shell->GetTaskRunners().GetUITaskRunner()->PostTask(
222 [&latch, engine = shell->weak_engine_, &frame_content,
223 runtime_delegate]() {
224 for (auto& [view_id, view_content] : frame_content) {
225 engine->SetViewportMetrics(view_id, view_content.viewport_metrics);
226 }
227 const auto frame_begin_time = fml::TimePoint::Now();
228 const auto frame_end_time =
229 frame_begin_time + fml::TimeDelta::FromSecondsF(1.0 / 60.0);
230 std::unique_ptr<FrameTimingsRecorder> recorder =
231 std::make_unique<FrameTimingsRecorder>();
232 recorder->RecordVsync(frame_begin_time, frame_end_time);
233 engine->animator_->BeginFrame(std::move(recorder));
234
235 // The BeginFrame phase and the EndFrame phase must be performed in a
236 // single task, otherwise a normal vsync might be inserted in between,
237 // causing flaky assertion errors.
238
239 for (auto& [view_id, view_content] : frame_content) {
241 identity.setIdentity();
242 auto root_layer = std::make_shared<TransformLayer>(identity);
243 auto layer_tree = std::make_unique<LayerTree>(
244 root_layer,
245 SkISize::Make(view_content.viewport_metrics.physical_width,
246 view_content.viewport_metrics.physical_height));
247 float device_pixel_ratio = static_cast<float>(
248 view_content.viewport_metrics.device_pixel_ratio);
249 if (view_content.builder) {
250 view_content.builder(root_layer);
251 }
252 runtime_delegate->Render(view_id, std::move(layer_tree),
253 device_pixel_ratio);
254 }
255 engine->animator_->EndFrame();
256 latch.Signal();
257 });
258 latch.Wait();
259}
for(const auto glyph :glyphs)
Definition: FontMgrTest.cpp:52
static constexpr TimeDelta FromSecondsF(double seconds)
Definition: time_delta.h:53
static TimePoint Now()
Definition: time_point.cc:49
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ RestartEngine()

void flutter::testing::ShellTest::RestartEngine ( Shell shell,
RunConfiguration  configuration 
)
static

Definition at line 118 of file shell_test.cc.

118 {
119 std::promise<bool> restarted;
121 shell->GetTaskRunners().GetUITaskRunner(),
122 [shell, &restarted, &configuration]() {
123 restarted.set_value(shell->engine_->Restart(std::move(configuration)));
124 });
125 ASSERT_TRUE(restarted.get_future().get());
126}

◆ RunEngine()

void flutter::testing::ShellTest::RunEngine ( Shell shell,
RunConfiguration  configuration 
)
static

Definition at line 104 of file shell_test.cc.

104 {
107 shell->GetTaskRunners().GetPlatformTaskRunner(),
108 [shell, &latch, &configuration]() {
109 shell->RunEngine(std::move(configuration),
110 [&latch](Engine::RunStatus run_status) {
111 ASSERT_EQ(run_status, Engine::RunStatus::Success);
112 latch.Signal();
113 });
114 });
115 latch.Wait();
116}

◆ SendEnginePlatformMessage()

void flutter::testing::ShellTest::SendEnginePlatformMessage ( Shell shell,
std::unique_ptr< PlatformMessage message 
)

Definition at line 68 of file shell_test.cc.

70 {
73 shell->GetTaskRunners().GetPlatformTaskRunner(),
75 [shell, &latch, message = std::move(message)]() mutable {
76 if (auto engine = shell->weak_engine_) {
77 engine->HandlePlatformMessage(std::move(message));
78 }
79 latch.Signal();
80 }));
81 latch.Wait();
82}
Win32Message message
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition: make_copyable.h:57

◆ SendPlatformMessage()

void flutter::testing::ShellTest::SendPlatformMessage ( Shell shell,
std::unique_ptr< PlatformMessage message 
)

Definition at line 63 of file shell_test.cc.

64 {
65 shell->OnPlatformViewDispatchPlatformMessage(std::move(message));
66}

◆ SetNeedsReportTimings()

void flutter::testing::ShellTest::SetNeedsReportTimings ( Shell shell,
bool  value 
)
static

Definition at line 286 of file shell_test.cc.

286 {
287 shell->SetNeedsReportTimings(value);
288}
uint8_t value

◆ SetViewportMetrics()

void flutter::testing::ShellTest::SetViewportMetrics ( Shell shell,
double  width,
double  height 
)
static

Definition at line 154 of file shell_test.cc.

154 {
155 flutter::ViewportMetrics viewport_metrics = {
156 1, // device pixel ratio
157 width, // physical width
158 height, // physical height
159 0, // padding top
160 0, // padding right
161 0, // padding bottom
162 0, // padding left
163 0, // view inset top
164 0, // view inset right
165 0, // view inset bottom
166 0, // view inset left
167 0, // gesture inset top
168 0, // gesture inset right
169 0, // gesture inset bottom
170 0, // gesture inset left
171 22, // physical touch slop
172 std::vector<double>(), // display features bounds
173 std::vector<int>(), // display features type
174 std::vector<int>(), // display features state
175 0 // Display ID
176 };
177 // Set viewport to nonempty, and call Animator::BeginFrame to make the layer
178 // tree pipeline nonempty. Without either of this, the layer tree below
179 // won't be rasterized.
181 shell->GetTaskRunners().GetUITaskRunner()->PostTask(
182 [&latch, engine = shell->weak_engine_, viewport_metrics]() {
183 if (engine) {
184 engine->SetViewportMetrics(kImplicitViewId, viewport_metrics);
185 const auto frame_begin_time = fml::TimePoint::Now();
186 const auto frame_end_time =
187 frame_begin_time + fml::TimeDelta::FromSecondsF(1.0 / 60.0);
188 std::unique_ptr<FrameTimingsRecorder> recorder =
189 std::make_unique<FrameTimingsRecorder>();
190 recorder->RecordVsync(frame_begin_time, frame_end_time);
191 engine->animator_->BeginFrame(std::move(recorder));
192 engine->animator_->EndFrame();
193 }
194 latch.Signal();
195 });
196 latch.Wait();
197}
int32_t height
int32_t width

◆ StorePersistentCache()

void flutter::testing::ShellTest::StorePersistentCache ( PersistentCache cache,
const SkData key,
const SkData value 
)
static

Definition at line 294 of file shell_test.cc.

296 {
297 cache->store(key, value);
298}
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition: switches.h:191

◆ TurnOffGPU()

void flutter::testing::ShellTest::TurnOffGPU ( Shell shell,
bool  value 
)
static

Definition at line 424 of file shell_test.cc.

424 {
425 shell->is_gpu_disabled_sync_switch_->SetSwitch(value);
426}

◆ UnreportedTimingsCount()

int flutter::testing::ShellTest::UnreportedTimingsCount ( Shell shell)
static

Definition at line 282 of file shell_test.cc.

282 {
283 return shell->unreported_timings_.size();
284}

◆ VSyncFlush()

void flutter::testing::ShellTest::VSyncFlush ( Shell shell,
bool *  will_draw_new_frame = nullptr 
)
static

Issue as many VSYNC as needed to flush the UI tasks so far, and reset the content of will_draw_new_frame to true if it's not nullptr.

Definition at line 128 of file shell_test.cc.

128 {
131 shell->GetTaskRunners().GetPlatformTaskRunner(),
132 [shell, will_draw_new_frame, &latch] {
133 // The following UI task ensures that all previous UI tasks are flushed.
134 fml::AutoResetWaitableEvent ui_latch;
135 shell->GetTaskRunners().GetUITaskRunner()->PostTask(
136 [&ui_latch, will_draw_new_frame]() {
137 if (will_draw_new_frame != nullptr) {
138 *will_draw_new_frame = true;
139 }
140 ui_latch.Signal();
141 });
142
143 ShellTestPlatformView* test_platform_view =
144 static_cast<ShellTestPlatformView*>(shell->GetPlatformView().get());
145 do {
146 test_platform_view->SimulateVSync();
147 } while (ui_latch.WaitWithTimeout(fml::TimeDelta::FromMilliseconds(1)));
148
149 latch.Signal();
150 });
151 latch.Wait();
152}
static constexpr TimeDelta FromMilliseconds(int64_t millis)
Definition: time_delta.h:46

The documentation for this class was generated from the following files: