Unverified Commit 6a99a8d9 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Ensure web restart analytics events aren't sent for failures/dont serve...

Ensure web restart analytics events aren't sent for failures/dont serve devtools by default  (#42260)

parent 0c1d1324
......@@ -274,12 +274,13 @@ class ResidentWebRunner extends ResidentRunner {
printStatus('Restarted application in ${getElapsedAsMilliseconds(timer.elapsed)}.');
// Send timing analytics for full restart and for refresh.
final bool wasSuccessful = reloadResponse.type == 'Success';
if (!wasSuccessful) {
return OperationResult(1, reloadResponse.toString());
}
flutterUsage.sendTiming('hot', 'web-restart', timer.elapsed);
flutterUsage.sendTiming('hot', 'web-refresh', timer.elapsed - recompileDuration);
return reloadResponse.type == 'Success'
? OperationResult.ok
: OperationResult(1, reloadResponse.toString());
return OperationResult.ok;
} on vmservice.RPCError {
return OperationResult(1, 'Page requires refresh.');
} finally {
......
......@@ -289,7 +289,7 @@ class WebFs {
return (await ChromeLauncher.connectedInstance).chromeConnection;
},
reloadConfiguration: ReloadConfiguration.none,
serveDevTools: true,
serveDevTools: false,
verbose: false,
enableDebugExtension: true,
logWriter: (dynamic level, String message) => printTrace(message),
......
......@@ -240,6 +240,11 @@ void main() {
expect(result.code, 1);
expect(result.message, contains('Failed to recompile application.'));
verifyNever(Usage.instance.sendTiming('hot', 'web-restart', any));
verifyNever(Usage.instance.sendTiming('hot', 'web-refresh', any));
verifyNever(Usage.instance.sendTiming('hot', 'web-recompile', any));
}, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(),
}));
test('Fails on vmservice response error', () => testbed.run(() async {
......@@ -259,6 +264,11 @@ void main() {
expect(result.code, 1);
expect(result.message, contains('Failed'));
verifyNever(Usage.instance.sendTiming('hot', 'web-restart', any));
verifyNever(Usage.instance.sendTiming('hot', 'web-refresh', any));
verify(Usage.instance.sendTiming('hot', 'web-recompile', any)).called(1);
}, overrides: <Type, Generator>{
Usage: () => MockFlutterUsage(),
}));
test('Fails on vmservice RpcError', () => testbed.run(() async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment