OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:convert' show UTF8; |
| 6 |
| 7 import 'package:http/http.dart'; |
| 8 import 'package:http/testing.dart'; |
| 9 import 'package:telemetry/crash_reporting.dart'; |
| 10 import 'package:test/test.dart'; |
| 11 import 'package:usage/usage.dart'; |
| 12 |
| 13 void main() { |
| 14 group('crash_reporting', () { |
| 15 MockClient mockClient; |
| 16 |
| 17 Request request; |
| 18 |
| 19 setUp(() { |
| 20 mockClient = new MockClient((Request r) async { |
| 21 request = r; |
| 22 return new Response('crash-report-001', 200); |
| 23 }); |
| 24 }); |
| 25 |
| 26 test('CrashReportSender', () async { |
| 27 AnalyticsMock analytics = new AnalyticsMock(); |
| 28 CrashReportSender sender = |
| 29 new CrashReportSender(analytics, httpClient: mockClient); |
| 30 |
| 31 await sender.sendReport('test-error', stackTrace: StackTrace.current); |
| 32 |
| 33 String body = UTF8.decode(request.bodyBytes); |
| 34 expect(body, contains('String')); // error.runtimeType |
| 35 expect(body, contains(analytics.trackingId)); |
| 36 expect(body, contains('1.0.0')); |
| 37 expect(body, contains(analytics.clientId)); |
| 38 }); |
| 39 }); |
| 40 } |
OLD | NEW |