Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
b3fe3e95
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,发现更多精彩内容 >>
提交
b3fe3e95
编写于
6月 30, 2019
作者:
J
Jason Simmons
提交者:
Chinmay Garde
6月 30, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix a race in the embedder accessibility unit test (#9585)
上级
55818f60
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
23 deletion
+45
-23
shell/platform/embedder/fixtures/main.dart
shell/platform/embedder/fixtures/main.dart
+3
-3
shell/platform/embedder/tests/embedder_a11y_unittests.cc
shell/platform/embedder/tests/embedder_a11y_unittests.cc
+42
-20
未找到文件。
shell/platform/embedder/fixtures/main.dart
浏览文件 @
b3fe3e95
...
...
@@ -45,9 +45,9 @@ Float64List kTestTransform = () {
}();
void
signalNativeTest
(
)
native
'SignalNativeTest'
;
void
notifySemanticsEnabled
(
bool
enabled
)
native
'Notify
TestData
'
;
void
notifyAccessibilityFeatures
(
bool
reduceMotion
)
native
'Notify
TestData
'
;
void
notifySemanticsAction
(
int
nodeId
,
int
action
,
List
<
int
>
data
)
native
'Notify
TestData
'
;
void
notifySemanticsEnabled
(
bool
enabled
)
native
'Notify
SemanticsEnabled
'
;
void
notifyAccessibilityFeatures
(
bool
reduceMotion
)
native
'Notify
AccessibilityFeatures
'
;
void
notifySemanticsAction
(
int
nodeId
,
int
action
,
List
<
int
>
data
)
native
'Notify
SemanticsAction
'
;
/// Returns a future that completes when `window.onSemanticsEnabledChanged`
/// fires.
...
...
shell/platform/embedder/tests/embedder_a11y_unittests.cc
浏览文件 @
b3fe3e95
...
...
@@ -24,7 +24,7 @@ using Embedder11yTest = testing::EmbedderTest;
// TODO: This test has been disabled as it is flaky (more reproducible in
// profile more). Multiple calls to a11y changed handler in Dart code is
// suspected. https://github.com/flutter/flutter/issues/35218
TEST_F
(
Embedder11yTest
,
DISABLED_
A11yTreeIsConsistent
)
{
TEST_F
(
Embedder11yTest
,
A11yTreeIsConsistent
)
{
auto
&
context
=
GetEmbedderContext
();
fml
::
AutoResetWaitableEvent
latch
;
...
...
@@ -37,13 +37,32 @@ TEST_F(Embedder11yTest, DISABLED_A11yTreeIsConsistent) {
})));
// Called by test fixture on UI thread to pass data back to this test.
NativeEntry
callback
;
NativeEntry
notify_semantics_enabled_
callback
;
context
.
AddNativeCallback
(
"NotifyTestData"
,
CREATE_NATIVE_ENTRY
(([
&
callback
](
Dart_NativeArguments
args
)
{
ASSERT_NE
(
callback
,
nullptr
);
callback
(
args
);
})));
"NotifySemanticsEnabled"
,
CREATE_NATIVE_ENTRY
(
([
&
notify_semantics_enabled_callback
](
Dart_NativeArguments
args
)
{
ASSERT_NE
(
notify_semantics_enabled_callback
,
nullptr
);
notify_semantics_enabled_callback
(
args
);
})));
NativeEntry
notify_accessibility_features_callback
;
context
.
AddNativeCallback
(
"NotifyAccessibilityFeatures"
,
CREATE_NATIVE_ENTRY
((
[
&
notify_accessibility_features_callback
](
Dart_NativeArguments
args
)
{
ASSERT_NE
(
notify_accessibility_features_callback
,
nullptr
);
notify_accessibility_features_callback
(
args
);
})));
NativeEntry
notify_semantics_action_callback
;
context
.
AddNativeCallback
(
"NotifySemanticsAction"
,
CREATE_NATIVE_ENTRY
(
([
&
notify_semantics_action_callback
](
Dart_NativeArguments
args
)
{
ASSERT_NE
(
notify_semantics_action_callback
,
nullptr
);
notify_semantics_action_callback
(
args
);
})));
EmbedderConfigBuilder
builder
(
context
);
builder
.
SetDartEntrypoint
(
"a11y_main"
);
...
...
@@ -52,7 +71,7 @@ TEST_F(Embedder11yTest, DISABLED_A11yTreeIsConsistent) {
ASSERT_TRUE
(
engine
.
is_valid
());
// Wait for initial NotifySemanticsEnabled(false).
callback
=
[
&
](
Dart_NativeArguments
args
)
{
notify_semantics_enabled_
callback
=
[
&
](
Dart_NativeArguments
args
)
{
bool
enabled
=
true
;
auto
handle
=
Dart_GetNativeBooleanArgument
(
args
,
0
,
&
enabled
);
ASSERT_FALSE
(
Dart_IsError
(
handle
));
...
...
@@ -61,8 +80,18 @@ TEST_F(Embedder11yTest, DISABLED_A11yTreeIsConsistent) {
};
latch
.
Wait
();
// Prepare to NotifyAccessibilityFeatures call
fml
::
AutoResetWaitableEvent
notify_features_latch
;
notify_accessibility_features_callback
=
[
&
](
Dart_NativeArguments
args
)
{
bool
enabled
=
true
;
auto
handle
=
Dart_GetNativeBooleanArgument
(
args
,
0
,
&
enabled
);
ASSERT_FALSE
(
Dart_IsError
(
handle
));
ASSERT_FALSE
(
enabled
);
notify_features_latch
.
Signal
();
};
// Enable semantics. Wait for NotifySemanticsEnabled(true).
callback
=
[
&
](
Dart_NativeArguments
args
)
{
notify_semantics_enabled_
callback
=
[
&
](
Dart_NativeArguments
args
)
{
bool
enabled
=
false
;
auto
handle
=
Dart_GetNativeBooleanArgument
(
args
,
0
,
&
enabled
);
ASSERT_FALSE
(
Dart_IsError
(
handle
));
...
...
@@ -74,17 +103,10 @@ TEST_F(Embedder11yTest, DISABLED_A11yTreeIsConsistent) {
latch
.
Wait
();
// Wait for initial accessibility features (reduce_motion == false)
callback
=
[
&
](
Dart_NativeArguments
args
)
{
bool
enabled
=
true
;
auto
handle
=
Dart_GetNativeBooleanArgument
(
args
,
0
,
&
enabled
);
ASSERT_FALSE
(
Dart_IsError
(
handle
));
ASSERT_FALSE
(
enabled
);
latch
.
Signal
();
};
latch
.
Wait
();
notify_features_latch
.
Wait
();
// Set accessibility features: (reduce_motion == true)
callback
=
[
&
](
Dart_NativeArguments
args
)
{
notify_accessibility_features_
callback
=
[
&
](
Dart_NativeArguments
args
)
{
bool
enabled
=
false
;
auto
handle
=
Dart_GetNativeBooleanArgument
(
args
,
0
,
&
enabled
);
ASSERT_FALSE
(
Dart_IsError
(
handle
));
...
...
@@ -137,7 +159,7 @@ TEST_F(Embedder11yTest, DISABLED_A11yTreeIsConsistent) {
ASSERT_EQ
(
1
,
action_batch_end_count
);
// Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
callback
=
[
&
](
Dart_NativeArguments
args
)
{
notify_semantics_action_
callback
=
[
&
](
Dart_NativeArguments
args
)
{
int64_t
node_id
=
0
;
Dart_GetNativeIntegerArgument
(
args
,
0
,
&
node_id
);
ASSERT_EQ
(
42
,
node_id
);
...
...
@@ -164,7 +186,7 @@ TEST_F(Embedder11yTest, DISABLED_A11yTreeIsConsistent) {
latch
.
Wait
();
// Disable semantics. Wait for NotifySemanticsEnabled(false).
callback
=
[
&
](
Dart_NativeArguments
args
)
{
notify_semantics_enabled_
callback
=
[
&
](
Dart_NativeArguments
args
)
{
bool
enabled
=
true
;
Dart_GetNativeBooleanArgument
(
args
,
0
,
&
enabled
);
ASSERT_FALSE
(
enabled
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录