Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: pkg/telemetry/test/crash_reporting_test.dart

Issue 2954733002: Add initial version of analytics and crash reporting package. (Closed)
Patch Set: updates from review comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/telemetry/pubspec.yaml ('k') | pkg/telemetry/test/telemetry_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « pkg/telemetry/pubspec.yaml ('k') | pkg/telemetry/test/telemetry_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698