Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
f873cd0c
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f873cd0c
编写于
7月 19, 2021
作者:
G
George Wright
提交者:
GitHub
7月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add unit tests for Dart entrypoint arguments on Windows (#27497)
上级
9edde742
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
1 deletion
+39
-1
shell/platform/windows/client_wrapper/dart_project_unittests.cc
...platform/windows/client_wrapper/dart_project_unittests.cc
+13
-0
shell/platform/windows/flutter_project_bundle_unittests.cc
shell/platform/windows/flutter_project_bundle_unittests.cc
+18
-0
shell/platform/windows/flutter_windows_engine_unittests.cc
shell/platform/windows/flutter_windows_engine_unittests.cc
+8
-1
未找到文件。
shell/platform/windows/client_wrapper/dart_project_unittests.cc
浏览文件 @
f873cd0c
...
...
@@ -42,4 +42,17 @@ TEST_F(DartProjectTest, ProjectWithCustomPaths) {
EXPECT_EQ
(
GetProjectAotLibraryPath
(
project
),
L"lib
\\
file.so"
);
}
TEST_F
(
DartProjectTest
,
DartEntrypointArguments
)
{
DartProject
project
(
L"test"
);
std
::
vector
<
std
::
string
>
test_arguments
=
{
"arg1"
,
"arg2"
,
"arg3"
};
project
.
set_dart_entrypoint_arguments
(
test_arguments
);
auto
returned_arguments
=
project
.
dart_entrypoint_arguments
();
EXPECT_EQ
(
returned_arguments
.
size
(),
3U
);
EXPECT_EQ
(
returned_arguments
[
0
],
"arg1"
);
EXPECT_EQ
(
returned_arguments
[
1
],
"arg2"
);
EXPECT_EQ
(
returned_arguments
[
2
],
"arg3"
);
}
}
// namespace flutter
shell/platform/windows/flutter_project_bundle_unittests.cc
浏览文件 @
f873cd0c
...
...
@@ -47,6 +47,24 @@ TEST(FlutterProjectBundle, SwitchesEmpty) {
EXPECT_EQ
(
project
.
GetSwitches
().
size
(),
0
);
}
TEST
(
FlutterProjectBundle
,
DartEntrypointArguments
)
{
FlutterDesktopEngineProperties
properties
=
{};
properties
.
assets_path
=
L"foo
\\
flutter_assets"
;
properties
.
icu_data_path
=
L"foo
\\
icudtl.dat"
;
std
::
vector
<
const
char
*>
test_arguments
=
{
"arg1"
,
"arg2"
};
properties
.
dart_entrypoint_argc
=
test_arguments
.
size
();
properties
.
dart_entrypoint_argv
=
test_arguments
.
data
();
FlutterProjectBundle
project
(
properties
);
std
::
vector
<
std
::
string
>
retrieved_arguments
=
project
.
dart_entrypoint_arguments
();
EXPECT_EQ
(
retrieved_arguments
.
size
(),
2U
);
EXPECT_EQ
(
retrieved_arguments
[
0
],
"arg1"
);
EXPECT_EQ
(
retrieved_arguments
[
1
],
"arg2"
);
}
#ifndef FLUTTER_RELEASE
TEST
(
FlutterProjectBundle
,
Switches
)
{
FlutterDesktopEngineProperties
properties
=
{};
...
...
shell/platform/windows/flutter_windows_engine_unittests.cc
浏览文件 @
f873cd0c
...
...
@@ -19,6 +19,11 @@ std::unique_ptr<FlutterWindowsEngine> GetTestEngine() {
properties
.
assets_path
=
L"C:
\\
foo
\\
flutter_assets"
;
properties
.
icu_data_path
=
L"C:
\\
foo
\\
icudtl.dat"
;
properties
.
aot_library_path
=
L"C:
\\
foo
\\
aot.so"
;
std
::
vector
<
const
char
*>
test_arguments
=
{
"arg1"
,
"arg2"
};
properties
.
dart_entrypoint_argc
=
test_arguments
.
size
();
properties
.
dart_entrypoint_argv
=
test_arguments
.
data
();
FlutterProjectBundle
project
(
properties
);
auto
engine
=
std
::
make_unique
<
FlutterWindowsEngine
>
(
project
);
...
...
@@ -52,7 +57,9 @@ TEST(FlutterWindowsEngine, RunDoesExpectedInitialization) {
// Spot-check arguments.
EXPECT_STREQ
(
args
->
assets_path
,
"C:
\\
foo
\\
flutter_assets"
);
EXPECT_STREQ
(
args
->
icu_data_path
,
"C:
\\
foo
\\
icudtl.dat"
);
EXPECT_EQ
(
args
->
dart_entrypoint_argc
,
0
);
EXPECT_EQ
(
args
->
dart_entrypoint_argc
,
2U
);
EXPECT_EQ
(
strcmp
(
args
->
dart_entrypoint_argv
[
0
],
"arg1"
),
0
);
EXPECT_EQ
(
strcmp
(
args
->
dart_entrypoint_argv
[
1
],
"arg2"
),
0
);
EXPECT_NE
(
args
->
platform_message_callback
,
nullptr
);
EXPECT_NE
(
args
->
custom_task_runners
,
nullptr
);
EXPECT_EQ
(
args
->
custom_dart_entrypoint
,
nullptr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录