Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
aac836c6
Unverified
Commit
aac836c6
authored
Jun 19, 2020
by
Anna Gringauze
Committed by
GitHub
Jun 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabled expression evaluation by default (#59826)
parent
fbdc79e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
10 deletions
+63
-10
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-1
expression_evaluation_web_test.dart
...est/integration.shard/expression_evaluation_web_test.dart
+56
-8
test_driver.dart
...ges/flutter_tools/test/integration.shard/test_driver.dart
+6
-1
No files found.
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
aac836c6
...
...
@@ -209,7 +209,7 @@ abstract class FlutterCommand extends Command<void> {
hide:
true
,
);
argParser
.
addFlag
(
'web-enable-expression-evaluation'
,
defaultsTo:
fals
e
,
defaultsTo:
tru
e
,
help:
'Enables expression evaluation in the debugger.'
,
hide:
hide
,
);
...
...
packages/flutter_tools/test/integration.shard/expression_evaluation_web_test.dart
View file @
aac836c6
...
...
@@ -33,6 +33,14 @@ void batch1() {
tryToDelete
(
tempDir
);
}
Future
<
void
>
start
({
bool
expressionEvaluation
})
{
// The non-test project has a loop around its breakpoints.
// No need to start paused as all breakpoint would be eventually reached.
return
_flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
expressionEvaluation:
expressionEvaluation
);
}
Future
<
void
>
breakInBuildMethod
(
FlutterTestDriver
flutter
)
async
{
await
_flutter
.
breakAt
(
_project
.
buildMethodBreakpointUri
,
...
...
@@ -47,9 +55,17 @@ void batch1() {
);
}
test
(
'flutter run expression evaluation - error if expression evaluation disabled'
,
()
async
{
await
initProject
();
await
start
(
expressionEvaluation:
false
);
await
breakInTopLevelFunction
(
_flutter
);
await
failToEvaluateExpression
(
_flutter
);
await
cleanProject
();
},
skip:
'CI not setup for web tests'
);
// https://github.com/flutter/flutter/issues/53779
test
(
'flutter run expression evaluation - no native javascript objects in static scope'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome
:
true
);
await
start
(
expressionEvaluation
:
true
);
await
breakInTopLevelFunction
(
_flutter
);
await
checkStaticScope
(
_flutter
);
await
cleanProject
();
...
...
@@ -57,7 +73,7 @@ void batch1() {
test
(
'flutter run expression evaluation - can handle compilation errors'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome
:
true
);
await
start
(
expressionEvaluation
:
true
);
await
breakInTopLevelFunction
(
_flutter
);
await
evaluateErrorExpressions
(
_flutter
);
await
cleanProject
();
...
...
@@ -65,7 +81,7 @@ void batch1() {
test
(
'flutter run expression evaluation - can evaluate trivial expressions in top level function'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome
:
true
);
await
start
(
expressionEvaluation
:
true
);
await
breakInTopLevelFunction
(
_flutter
);
await
evaluateTrivialExpressions
(
_flutter
);
await
cleanProject
();
...
...
@@ -73,7 +89,7 @@ void batch1() {
test
(
'flutter run expression evaluation - can evaluate trivial expressions in build method'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome
:
true
);
await
start
(
expressionEvaluation
:
true
);
await
breakInBuildMethod
(
_flutter
);
await
evaluateTrivialExpressions
(
_flutter
);
await
cleanProject
();
...
...
@@ -81,7 +97,7 @@ void batch1() {
test
(
'flutter run expression evaluation - can evaluate complex expressions in top level function'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome
:
true
);
await
start
(
expressionEvaluation
:
true
);
await
breakInTopLevelFunction
(
_flutter
);
await
evaluateComplexExpressions
(
_flutter
);
await
cleanProject
();
...
...
@@ -113,15 +129,35 @@ void batch2() {
}
Future
<
void
>
breakInMethod
(
FlutterTestDriver
flutter
)
async
{
await
_flutter
.
breakA
t
(
await
_flutter
.
addBreakpoin
t
(
_project
.
breakpointAppUri
,
_project
.
breakpointLine
,
);
await
_flutter
.
resume
();
await
_flutter
.
waitForPause
();
}
Future
<
void
>
startPaused
({
bool
expressionEvaluation
})
{
// The test project does not have a loop around its breakpoints.
// Start paused so we can set a breakpoint before passing it
// in the execution.
return
_flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
expressionEvaluation:
expressionEvaluation
,
startPaused:
true
,
script:
_project
.
testFilePath
);
}
test
(
'flutter test expression evaluation - error if expression evaluation disabled'
,
()
async
{
await
initProject
();
await
startPaused
(
expressionEvaluation:
false
);
await
breakInMethod
(
_flutter
);
await
failToEvaluateExpression
(
_flutter
);
await
cleanProject
();
},
skip:
'CI not setup for web tests'
);
// https://github.com/flutter/flutter/issues/53779
test
(
'flutter test expression evaluation - can evaluate trivial expressions in a test'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
script:
_project
.
testFilePath
);
await
startPaused
(
expressionEvaluation:
true
);
await
breakInMethod
(
_flutter
);
await
evaluateTrivialExpressions
(
_flutter
);
await
cleanProject
();
...
...
@@ -129,13 +165,25 @@ void batch2() {
test
(
'flutter test expression evaluation - can evaluate complex expressions in a test'
,
()
async
{
await
initProject
();
await
_flutter
.
run
(
withDebugger:
true
,
chrome:
true
,
script:
_project
.
testFilePath
);
await
startPaused
(
expressionEvaluation:
true
);
await
breakInMethod
(
_flutter
);
await
evaluateComplexExpressions
(
_flutter
);
await
cleanProject
();
},
skip:
'CI not setup for web tests'
);
// https://github.com/flutter/flutter/issues/53779
}
Future
<
void
>
failToEvaluateExpression
(
FlutterTestDriver
flutter
)
async
{
ObjRef
res
;
try
{
res
=
await
flutter
.
evaluateInFrame
(
'"test"'
);
}
on
RPCError
catch
(
e
)
{
expect
(
e
.
message
,
contains
(
'UnimplementedError: '
'Expression evaluation is not supported for this configuration'
));
}
expect
(
res
,
null
);
}
Future
<
void
>
checkStaticScope
(
FlutterTestDriver
flutter
)
async
{
final
Frame
res
=
await
flutter
.
getTopStackFrame
();
expect
(
res
.
vars
,
equals
(<
BoundVariable
>[]));
...
...
packages/flutter_tools/test/integration.shard/test_driver.dart
View file @
aac836c6
...
...
@@ -437,6 +437,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
bool
startPaused
=
false
,
bool
pauseOnExceptions
=
false
,
bool
chrome
=
false
,
bool
expressionEvaluation
=
true
,
bool
structuredErrors
=
false
,
File
pidFile
,
String
script
,
...
...
@@ -449,7 +450,11 @@ class FlutterRunTestDriver extends FlutterTestDriver {
'--machine'
,
'-d'
,
if
(
chrome
)
...<
String
>[
'chrome'
,
'--web-run-headless'
,
'--web-enable-expression-evaluation'
]
...<
String
>[
'chrome'
,
'--web-run-headless'
,
if
(!
expressionEvaluation
)
'--no-web-enable-expression-evaluation'
]
else
'flutter-tester'
,
if
(
structuredErrors
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment