Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
aefa753e
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aefa753e
编写于
3月 30, 2018
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updates from code review feedback
上级
1d5c75e3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
9 deletion
+22
-9
src/VisualStudio/IntegrationTest/TestUtilities/AutomationElementExtensions.cs
...egrationTest/TestUtilities/AutomationElementExtensions.cs
+16
-3
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
...tionTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
+6
-6
未找到文件。
src/VisualStudio/IntegrationTest/TestUtilities/AutomationElementExtensions.cs
浏览文件 @
aefa753e
...
...
@@ -13,7 +13,18 @@ namespace Microsoft.VisualStudio.IntegrationTest.Utilities
public
static
class
AutomationElementExtensions
{
private
const
int
UIA_E_ELEMENTNOTAVAILABLE
=
unchecked
((
int
)
0x80040201
);
private
const
int
AutomationRetryCount
=
3
;
/// <summary>
/// The number of times to retry a UI automation operation that failed with
/// <see cref="UIA_E_ELEMENTNOTAVAILABLE"/>, not counting the initial call. A value of 2 means the operation
/// will be attempted a total of three times.
/// </summary>
private
const
int
AutomationRetryCount
=
2
;
/// <summary>
/// The delay between retrying a UI automation operation that failed with
/// <see cref="UIA_E_ELEMENTNOTAVAILABLE"/>.
/// </summary>
private
static
readonly
TimeSpan
AutomationRetryDelay
=
TimeSpan
.
FromMilliseconds
(
100
);
/// <summary>
...
...
@@ -334,6 +345,7 @@ private static string GetNameForExceptionMessage(this IUIAutomationElement eleme
private
static
void
RetryIfNotAvailable
<
T
>(
Action
<
T
>
action
,
T
state
)
{
// NOTE: The loop termination condition if exceptions are thrown is in the exception filter
for
(
var
i
=
0
;
true
;
i
++)
{
try
...
...
@@ -341,7 +353,7 @@ private static void RetryIfNotAvailable<T>(Action<T> action, T state)
action
(
state
);
return
;
}
catch
(
COMException
e
)
when
(
e
.
HResult
==
UIA_E_ELEMENTNOTAVAILABLE
&&
i
<
AutomationRetryCount
-
1
)
catch
(
COMException
e
)
when
(
e
.
HResult
==
UIA_E_ELEMENTNOTAVAILABLE
&&
i
<
AutomationRetryCount
)
{
Thread
.
Sleep
(
AutomationRetryDelay
);
continue
;
...
...
@@ -351,13 +363,14 @@ private static void RetryIfNotAvailable<T>(Action<T> action, T state)
private
static
TResult
RetryIfNotAvailable
<
T
,
TResult
>(
Func
<
T
,
TResult
>
function
,
T
state
)
{
// NOTE: The loop termination condition if exceptions are thrown is in the exception filter
for
(
var
i
=
0
;
true
;
i
++)
{
try
{
return
function
(
state
);
}
catch
(
COMException
e
)
when
(
e
.
HResult
==
UIA_E_ELEMENTNOTAVAILABLE
&&
i
<
AutomationRetryCount
-
1
)
catch
(
COMException
e
)
when
(
e
.
HResult
==
UIA_E_ELEMENTNOTAVAILABLE
&&
i
<
AutomationRetryCount
)
{
Thread
.
Sleep
(
AutomationRetryDelay
);
continue
;
...
...
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
浏览文件 @
aefa753e
...
...
@@ -288,7 +288,7 @@ public string[] GetLightBulbActions()
var
view
=
GetActiveTextView
();
var
broker
=
GetComponentModel
().
GetService
<
ILightBulbBroker
>();
return
(
await
GetLightBulbActionsAsync
(
broker
,
view
)).
Select
(
a
=>
a
.
DisplayText
).
ToArray
();
return
(
await
GetLightBulbActionsAsync
(
broker
,
view
)
.
ConfigureAwait
(
false
)
).
Select
(
a
=>
a
.
DisplayText
).
ToArray
();
});
}
...
...
@@ -312,7 +312,7 @@ private async Task<IEnumerable<ISuggestedAction>> GetLightBulbActionsAsync(ILigh
actionSets
=
Array
.
Empty
<
SuggestedActionSet
>();
}
return
await
SelectActionsAsync
(
actionSets
);
return
await
SelectActionsAsync
(
actionSets
)
.
ConfigureAwait
(
false
)
;
}
public
void
ApplyLightBulbAction
(
string
actionName
,
FixAllScope
?
fixAllScope
,
bool
blockUntilComplete
)
...
...
@@ -323,7 +323,7 @@ public void ApplyLightBulbAction(string actionName, FixAllScope? fixAllScope, bo
await
ThreadHelper
.
JoinableTaskFactory
.
SwitchToMainThreadAsync
();
var
activeTextView
=
GetActiveTextView
();
await
lightBulbAction
(
activeTextView
);
await
lightBulbAction
(
activeTextView
)
.
ConfigureAwait
(
false
)
;
});
if
(
blockUntilComplete
)
...
...
@@ -400,7 +400,7 @@ private async Task<IEnumerable<ISuggestedAction>> SelectActionsAsync(IEnumerable
foreach
(
var
action
in
actionSet
.
Actions
)
{
actions
.
Add
(
action
);
actions
.
AddRange
(
await
SelectActionsAsync
(
await
action
.
GetActionSetsAsync
(
CancellationToken
.
None
)));
actions
.
AddRange
(
await
SelectActionsAsync
(
await
action
.
GetActionSetsAsync
(
CancellationToken
.
None
)
.
ConfigureAwait
(
false
)).
ConfigureAwait
(
false
));
}
}
}
...
...
@@ -426,8 +426,8 @@ private static async Task<FixAllSuggestedAction> GetFixAllSuggestedActionAsync(I
if
(
action
.
HasActionSets
)
{
var
nestedActionSets
=
await
action
.
GetActionSetsAsync
(
CancellationToken
.
None
);
fixAllSuggestedAction
=
await
GetFixAllSuggestedActionAsync
(
nestedActionSets
,
fixAllScope
);
var
nestedActionSets
=
await
action
.
GetActionSetsAsync
(
CancellationToken
.
None
)
.
ConfigureAwait
(
false
)
;
fixAllSuggestedAction
=
await
GetFixAllSuggestedActionAsync
(
nestedActionSets
,
fixAllScope
)
.
ConfigureAwait
(
false
)
;
if
(
fixAllSuggestedAction
!=
null
)
{
return
fixAllSuggestedAction
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录