Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
57f8abb7
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
未验证
提交
57f8abb7
编写于
4月 18, 2019
作者:
C
Chinmay Garde
提交者:
GitHub
4月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid leaking the VM in the shell unittests and assert VM state in existing tests. (#8628)
上级
edef8bb8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
0 deletion
+27
-0
shell/common/shell_test.cc
shell/common/shell_test.cc
+1
-0
shell/common/shell_unittests.cc
shell/common/shell_unittests.cc
+26
-0
未找到文件。
shell/common/shell_test.cc
浏览文件 @
57f8abb7
...
...
@@ -83,6 +83,7 @@ void ShellTest::SetSnapshotsAndAssets(Settings& settings) {
Settings
ShellTest
::
CreateSettingsForFixture
()
{
Settings
settings
;
settings
.
leak_vm
=
false
;
settings
.
task_observer_add
=
[](
intptr_t
key
,
fml
::
closure
handler
)
{
fml
::
MessageLoop
::
GetCurrent
().
AddTaskObserver
(
key
,
handler
);
};
...
...
shell/common/shell_unittests.cc
浏览文件 @
57f8abb7
...
...
@@ -83,6 +83,7 @@ static bool ValidateShell(Shell* shell) {
}
TEST_F
(
ShellTest
,
InitializeWithInvalidThreads
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
Settings
settings
=
CreateSettingsForFixture
();
TaskRunners
task_runners
(
"test"
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
auto
shell
=
Shell
::
Create
(
...
...
@@ -95,9 +96,11 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) {
return
std
::
make_unique
<
Rasterizer
>
(
shell
.
GetTaskRunners
());
});
ASSERT_FALSE
(
shell
);
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
TEST_F
(
ShellTest
,
InitializeWithDifferentThreads
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
...
...
@@ -117,9 +120,13 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) {
return
std
::
make_unique
<
Rasterizer
>
(
shell
.
GetTaskRunners
());
});
ASSERT_TRUE
(
ValidateShell
(
shell
.
get
()));
ASSERT_TRUE
(
DartVMRef
::
IsInstanceRunning
());
shell
.
reset
();
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
TEST_F
(
ShellTest
,
InitializeWithSingleThread
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
...
...
@@ -136,10 +143,14 @@ TEST_F(ShellTest, InitializeWithSingleThread) {
[](
Shell
&
shell
)
{
return
std
::
make_unique
<
Rasterizer
>
(
shell
.
GetTaskRunners
());
});
ASSERT_TRUE
(
DartVMRef
::
IsInstanceRunning
());
ASSERT_TRUE
(
ValidateShell
(
shell
.
get
()));
shell
.
reset
();
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
TEST_F
(
ShellTest
,
InitializeWithSingleThreadWhichIsTheCallingThread
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
Settings
settings
=
CreateSettingsForFixture
();
fml
::
MessageLoop
::
EnsureInitializedForCurrentThread
();
auto
task_runner
=
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
();
...
...
@@ -155,10 +166,14 @@ TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) {
return
std
::
make_unique
<
Rasterizer
>
(
shell
.
GetTaskRunners
());
});
ASSERT_TRUE
(
ValidateShell
(
shell
.
get
()));
ASSERT_TRUE
(
DartVMRef
::
IsInstanceRunning
());
shell
.
reset
();
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
TEST_F
(
ShellTest
,
InitializeWithMultipleThreadButCallingThreadAsPlatformThread
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
...
...
@@ -179,9 +194,13 @@ TEST_F(ShellTest,
return
std
::
make_unique
<
Rasterizer
>
(
shell
.
GetTaskRunners
());
});
ASSERT_TRUE
(
ValidateShell
(
shell
.
get
()));
ASSERT_TRUE
(
DartVMRef
::
IsInstanceRunning
());
shell
.
reset
();
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
TEST_F
(
ShellTest
,
InitializeWithGPUAndPlatformThreadsTheSame
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
...
...
@@ -202,10 +221,14 @@ TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) {
[](
Shell
&
shell
)
{
return
std
::
make_unique
<
Rasterizer
>
(
shell
.
GetTaskRunners
());
});
ASSERT_TRUE
(
DartVMRef
::
IsInstanceRunning
());
ASSERT_TRUE
(
ValidateShell
(
shell
.
get
()));
shell
.
reset
();
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
TEST_F
(
ShellTest
,
FixturesAreFunctional
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
const
auto
settings
=
CreateSettingsForFixture
();
auto
shell
=
Shell
::
Create
(
GetTaskRunnersForFixture
(),
settings
,
...
...
@@ -239,6 +262,9 @@ TEST_F(ShellTest, FixturesAreFunctional) {
latch
.
Wait
();
main_latch
.
Wait
();
ASSERT_TRUE
(
DartVMRef
::
IsInstanceRunning
());
shell
.
reset
();
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
}
}
// namespace testing
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录