Flutter Engine
 
Loading...
Searching...
No Matches
single_frame_codec_unittests.cc
Go to the documentation of this file.
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
6
7#include <memory>
8
15
16namespace flutter {
17namespace testing {
18
19TEST_F(ShellTest, SingleFrameCodecAccuratelyReportsSize) {
20 auto message_latch = std::make_shared<fml::AutoResetWaitableEvent>();
21
22 auto validate_codec = [](Dart_NativeArguments args) {
23 auto handle = Dart_GetNativeArgument(args, 0);
24 intptr_t peer = 0;
25 Dart_Handle result = Dart_GetNativeInstanceField(
27 ASSERT_FALSE(Dart_IsError(result));
28 };
29 auto finish = [message_latch](Dart_NativeArguments args) {
30 message_latch->Signal();
31 };
32
33 Settings settings = CreateSettingsForFixture();
34 TaskRunners task_runners("test", // label
35 GetCurrentTaskRunner(), // platform
36 CreateNewThread(), // raster
37 CreateNewThread(), // ui
38 CreateNewThread() // io
39 );
40
41 AddNativeCallback("ValidateCodec", CREATE_NATIVE_ENTRY(validate_codec));
42 AddNativeCallback("Finish", CREATE_NATIVE_ENTRY(finish));
43
44 std::unique_ptr<Shell> shell = CreateShell(settings, task_runners);
45
46 ASSERT_TRUE(shell->IsSetup());
47 auto configuration = RunConfiguration::InferFromSettings(settings);
48 configuration.SetEntrypoint("createSingleFrameCodec");
49
50 shell->RunEngine(std::move(configuration), [](auto result) {
51 ASSERT_EQ(result, Engine::RunStatus::Success);
52 });
53
54 message_latch->Wait();
55 DestroyShell(std::move(shell), task_runners);
56}
57
58} // namespace testing
59} // namespace flutter
static RunConfiguration InferFromSettings(const Settings &settings, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer a run configuration from the settings object. This tries to create a run configurat...
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
TEST_F(DisplayListTest, Defaults)
#define CREATE_NATIVE_ENTRY(native_entry)