Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
d8ff2432
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,发现更多精彩内容 >>
未验证
提交
d8ff2432
编写于
7月 12, 2021
作者:
D
Dan Field
提交者:
GitHub
7月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the firebase scenario app run and assert that it does good things (#27295)
上级
72a24f81
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
73 addition
and
46 deletion
+73
-46
ci/firebase_testlab.sh
ci/firebase_testlab.sh
+13
-0
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
...io/flutter/embedding/engine/renderer/FlutterRenderer.java
+22
-1
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java
...oidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java
+1
-1
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java
.../java/dev/flutter/scenariosui/PlatformTextureUiTests.java
+12
-12
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java
...est/java/dev/flutter/scenariosui/PlatformViewUiTests.java
+12
-12
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java
...idTest/java/dev/flutter/scenariosui/SpawnEngineTests.java
+1
-1
testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java
...app/src/main/java/dev/flutter/scenarios/TestActivity.java
+6
-7
testing/scenario_app/lib/main.dart
testing/scenario_app/lib/main.dart
+6
-12
未找到文件。
ci/firebase_testlab.sh
浏览文件 @
d8ff2432
...
...
@@ -33,3 +33,16 @@ gcloud --project flutter-infra firebase test android run \
--results-bucket
=
gs://flutter_firebase_testlab
\
--results-dir
=
"engine_scenario_test/
$GIT_REVISION
/
$BUILD_ID
"
\
--device
model
=
flame,version
=
29
errors
=
$(
gsutil
cat
gs://flutter_firebase_testlab/engine_scenario_test/
$GIT_REVISION
/
$BUILD_ID
/
\*
/logcat |
grep
"[FE]/flutter"
|
true
)
if
[[
!
-z
$errors
]]
;
then
echo
"Errors detected in logcat:"
echo
"
$errors
"
exit
1
fi
result_size
=
$(
gsutil
du
gs://flutter_firebase_testlab/engine_scenario_test/
$GIT_REVISION
/
$BUILD_ID
/
\*
/game_loop_results/results_scenario_0.json |
cut
-d
" "
-f1
)
if
[[
$result_size
==
"0"
]]
;
then
echo
"Failed to produce a timeline."
exit
1
fi
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
浏览文件 @
d8ff2432
...
...
@@ -236,8 +236,20 @@ public class FlutterRenderer implements TextureRegistry {
isDisplayingFlutterUi
=
false
;
}
// TODO(mattcarroll): describe the native behavior that this invokes
/**
* Notifies Flutter that the viewport metrics, e.g. window height and width, have changed.
*
* <p>If the width, height, or devicePixelRatio are less than or equal to 0, this update is
* ignored.
*
* @param viewportMetrics The metrics to send to the Dart application.
*/
public
void
setViewportMetrics
(
@NonNull
ViewportMetrics
viewportMetrics
)
{
// We might get called with just the DPR if width/height aren't available yet.
// Just ignore, as it will get called again when width/height are set.
if
(!
viewportMetrics
.
validate
())
{
return
;
}
Log
.
v
(
TAG
,
"Setting viewport metrics\n"
...
...
@@ -360,5 +372,14 @@ public class FlutterRenderer implements TextureRegistry {
public
int
systemGestureInsetRight
=
0
;
public
int
systemGestureInsetBottom
=
0
;
public
int
systemGestureInsetLeft
=
0
;
/**
* Whether this instance contains valid metrics for the Flutter application.
*
* @return True if width, height, and devicePixelRatio are > 0; false otherwise.
*/
boolean
validate
()
{
return
width
>
0
&&
height
>
0
&&
devicePixelRatio
>
0
;
}
}
}
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java
浏览文件 @
d8ff2432
...
...
@@ -26,7 +26,7 @@ public class MemoryLeakTests {
@FailTestOnLeak
public
void
platformViewHybridComposition_launchActivityFinishAndLaunchAgain
()
throws
Exception
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
intent
.
putExtra
(
"scenario"
,
"platform_view"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view"
);
intent
.
putExtra
(
"use_android_view"
,
true
);
activityRule
.
launchActivity
(
intent
);
...
...
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java
浏览文件 @
d8ff2432
...
...
@@ -33,73 +33,73 @@ public class PlatformTextureUiTests {
@Test
public
void
testPlatformView
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewMultiple
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_multiple"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_multiple"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewMultipleBackgroundForeground
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_multiple_background_foreground"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_multiple_background_foreground"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewCliprect
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_cliprect"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_cliprect"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewCliprrect
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_cliprrect"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_cliprrect"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewClippath
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_clippath"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_clippath"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewTransform
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_transform"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_transform"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewOpacity
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_opacity"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_opacity"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewRotate
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_rotate"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_rotate"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewMultipleWithoutOverlays
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_multiple_without_overlays"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_multiple_without_overlays"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewTwoIntersectingOverlays
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_two_intersecting_overlays"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_two_intersecting_overlays"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewWithoutOverlayIntersection
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_no_overlay_intersection"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_no_overlay_intersection"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
}
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java
浏览文件 @
d8ff2432
...
...
@@ -33,73 +33,73 @@ public class PlatformViewUiTests {
@Test
public
void
testPlatformView
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewMultiple
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_multiple"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_multiple"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewMultipleBackgroundForeground
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_multiple_background_foreground"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_multiple_background_foreground"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewCliprect
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_cliprect"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_cliprect"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewCliprrect
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_cliprrect"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_cliprrect"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewClippath
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_clippath"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_clippath"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewTransform
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_transform"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_transform"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewOpacity
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_opacity"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_opacity"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewRotate
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_rotate"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_rotate"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewMultipleWithoutOverlays
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_multiple_without_overlays"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_multiple_without_overlays"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewTwoIntersectingOverlays
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_two_intersecting_overlays"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_two_intersecting_overlays"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
@Test
public
void
testPlatformViewWithoutOverlayIntersection
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"platform_view_no_overlay_intersection"
);
intent
.
putExtra
(
"scenario
_name
"
,
"platform_view_no_overlay_intersection"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
}
testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java
浏览文件 @
d8ff2432
...
...
@@ -31,7 +31,7 @@ public class SpawnEngineTests {
@Test
public
void
testSpawnedEngine
()
throws
Exception
{
intent
.
putExtra
(
"scenario"
,
"spawn_engine_works"
);
intent
.
putExtra
(
"scenario
_name
"
,
"spawn_engine_works"
);
ScreenshotUtil
.
capture
(
activityRule
.
launchActivity
(
intent
));
}
}
testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java
浏览文件 @
d8ff2432
...
...
@@ -39,7 +39,6 @@ public class TestActivity extends TestableFlutterActivity {
if
(
Build
.
VERSION
.
SDK_INT
>
22
)
{
requestPermissions
(
new
String
[]
{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
1
);
}
// Run for one minute, get the timeline data, write it, and finish.
final
Uri
logFileUri
=
launchIntent
.
getData
();
new
Handler
()
.
postDelayed
(
...
...
@@ -47,7 +46,6 @@ public class TestActivity extends TestableFlutterActivity {
@Override
public
void
run
()
{
writeTimelineData
(
logFileUri
);
testFlutterLoaderCallbackWhenInitializedTwice
();
}
},
...
...
@@ -70,13 +68,14 @@ public class TestActivity extends TestableFlutterActivity {
@Override
public
void
onFlutterUiDisplayed
()
{
final
Intent
launchIntent
=
getIntent
();
if
(!
launchIntent
.
hasExtra
(
"scenario"
))
{
return
;
}
MethodChannel
channel
=
new
MethodChannel
(
getFlutterEngine
().
getDartExecutor
(),
"driver"
,
JSONMethodCodec
.
INSTANCE
);
Map
<
String
,
Object
>
test
=
new
HashMap
<>(
2
);
test
.
put
(
"name"
,
launchIntent
.
getStringExtra
(
"scenario"
));
if
(
launchIntent
.
hasExtra
(
"scenario_name"
))
{
test
.
put
(
"name"
,
launchIntent
.
getStringExtra
(
"scenario_name"
));
}
else
{
test
.
put
(
"name"
,
"animated_color_square"
);
}
test
.
put
(
"use_android_view"
,
launchIntent
.
getBooleanExtra
(
"use_android_view"
,
false
));
channel
.
invokeMethod
(
"set_scenario"
,
test
);
}
...
...
@@ -102,7 +101,7 @@ public class TestActivity extends TestableFlutterActivity {
outputStream
.
write
(
reply
.
array
());
outputStream
.
close
();
}
catch
(
IOException
ex
)
{
Log
.
e
(
TAG
,
"Could not write timeline file
: "
+
ex
.
toString
()
);
Log
.
e
(
TAG
,
"Could not write timeline file
"
,
ex
);
}
finish
();
});
...
...
testing/scenario_app/lib/main.dart
浏览文件 @
d8ff2432
...
...
@@ -6,7 +6,6 @@
import
'dart:convert'
;
import
'dart:developer'
as
developer
;
import
'dart:io'
;
import
'dart:isolate'
;
import
'dart:typed_data'
;
import
'dart:ui'
;
...
...
@@ -41,7 +40,11 @@ void _handleDriverMessage(Map<String, dynamic> call) {
Future
<
void
>
_handlePlatformMessage
(
String
name
,
ByteData
data
,
PlatformMessageResponseCallback
callback
)
async
{
print
(
'
$name
=
${utf8.decode(data.buffer.asUint8List())}
'
);
if
(
data
!=
null
)
{
print
(
'
$name
=
${utf8.decode(data.buffer.asUint8List())}
'
);
}
else
{
print
(
name
);
}
switch
(
name
)
{
case
'driver'
:
...
...
@@ -57,21 +60,12 @@ Future<void> _handlePlatformMessage(
}
Future
<
String
>
_getTimelineData
()
async
{
final
String
isolateId
=
developer
.
Service
.
getIsolateID
(
Isolate
.
current
);
final
developer
.
ServiceProtocolInfo
info
=
await
developer
.
Service
.
getInfo
();
final
Uri
cpuProfileTimelineUri
=
info
.
serverUri
.
resolve
(
'_getCpuProfileTimeline?tags=None&isolateId=
$isolateId
'
,
);
final
Uri
vmServiceTimelineUri
=
info
.
serverUri
.
resolve
(
'getVMTimeline'
);
final
Map
<
String
,
dynamic
>
cpuTimelineJson
=
await
_getJson
(
cpuProfileTimelineUri
);
final
Map
<
String
,
dynamic
>
vmServiceTimelineJson
=
await
_getJson
(
vmServiceTimelineUri
);
final
Map
<
String
,
dynamic
>
cpuResult
=
cpuTimelineJson
[
'result'
]
as
Map
<
String
,
dynamic
>;
final
Map
<
String
,
dynamic
>
vmServiceResult
=
vmServiceTimelineJson
[
'result'
]
as
Map
<
String
,
dynamic
>;
return
json
.
encode
(<
String
,
dynamic
>{
'stackFrames'
:
cpuResult
[
'stackFrames'
],
'traceEvents'
:
<
dynamic
>[
...
cpuResult
[
'traceEvents'
]
as
List
<
dynamic
>,
...
vmServiceResult
[
'traceEvents'
]
as
List
<
dynamic
>,
],
});
...
...
@@ -82,7 +76,7 @@ Future<Map<String, dynamic>> _getJson(Uri uri) async {
final
HttpClientRequest
request
=
await
client
.
getUrl
(
uri
);
final
HttpClientResponse
response
=
await
request
.
close
();
if
(
response
.
statusCode
>
299
)
{
return
null
;
return
<
String
,
dynamic
>{}
;
}
final
String
data
=
await
utf8
.
decodeStream
(
response
);
return
json
.
decode
(
data
)
as
Map
<
String
,
dynamic
>;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录