Clean up crash reporting code (#8602)

This commit is contained in:
Yegor
2017-03-07 08:45:06 -08:00
committed by GitHub
parent 24eeddc053
commit 5e2d3e956a
2 changed files with 14 additions and 21 deletions

View File

@@ -15,26 +15,22 @@ import 'package:flutter_tools/executable.dart' as tools;
import 'package:flutter_tools/src/base/context.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/os.dart' as os;
import 'package:flutter_tools/src/crash_reporting.dart';
import 'package:flutter_tools/src/runner/flutter_command.dart';
import 'src/context.dart';
void main() {
group('crash reporting', () {
int testPort;
setUp(() async {
tools.crashFileSystem = new MemoryFileSystem();
setExitFunctionForTests((_) { });
testPort = await os.findAvailablePort();
overrideBaseCrashUrlForTesting(Uri.parse('http://localhost:$testPort/test-path'));
enterTestingMode();
});
tearDown(() {
tools.crashFileSystem = new LocalFileSystem();
restoreExitFunction();
resetBaseCrashUrlForTesting();
exitTestingMode();
});
testUsingContext('should send crash reports', () async {
@@ -62,10 +58,10 @@ void main() {
// Verify that we sent the crash report.
expect(method, 'POST');
expect(uri, new Uri(
scheme: 'http',
host: 'localhost',
port: testPort,
path: '/test-path',
scheme: 'https',
host: 'clients2.google.com',
port: 443,
path: '/cr/staging_report',
queryParameters: <String, String>{
'product': 'Flutter_Tools',
'version' : 'test-version',