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

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

Issue 2963323002: Add analytics to analyzer-cli and analysis server. (Closed)
Patch Set: update 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:convert' show UTF8; 5 import 'dart:convert' show UTF8;
6 6
7 import 'package:http/http.dart'; 7 import 'package:http/http.dart';
8 import 'package:http/testing.dart'; 8 import 'package:http/testing.dart';
9 import 'package:telemetry/crash_reporting.dart'; 9 import 'package:telemetry/crash_reporting.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
11 import 'package:usage/usage.dart'; 11 import 'package:usage/usage.dart';
12 12
13 void main() { 13 void main() {
14 group('crash_reporting', () { 14 group('crash_reporting', () {
15 MockClient mockClient; 15 MockClient mockClient;
16 16
17 Request request; 17 Request request;
18 18
19 setUp(() { 19 setUp(() {
20 mockClient = new MockClient((Request r) async { 20 mockClient = new MockClient((Request r) async {
21 request = r; 21 request = r;
22 return new Response('crash-report-001', 200); 22 return new Response('crash-report-001', 200);
23 }); 23 });
24 }); 24 });
25 25
26 test('CrashReportSender', () async { 26 test('CrashReportSender', () async {
27 AnalyticsMock analytics = new AnalyticsMock(); 27 AnalyticsMock analytics = new AnalyticsMock()..enabled = false;
28 CrashReportSender sender = 28 CrashReportSender sender = new CrashReportSender(
29 new CrashReportSender(analytics, httpClient: mockClient); 29 analytics.trackingId, analytics,
30 httpClient: mockClient);
30 31
31 await sender.sendReport('test-error', stackTrace: StackTrace.current); 32 await sender.sendReport('test-error', stackTrace: StackTrace.current);
32 33
33 String body = UTF8.decode(request.bodyBytes); 34 String body = UTF8.decode(request.bodyBytes);
34 expect(body, contains('String')); // error.runtimeType 35 expect(body, contains('String')); // error.runtimeType
35 expect(body, contains(analytics.trackingId)); 36 expect(body, contains(analytics.trackingId));
36 expect(body, contains('1.0.0')); 37 expect(body, contains('1.0.0'));
37 expect(body, contains(analytics.clientId)); 38 expect(body, contains(analytics.clientId));
38 }); 39 });
39 }); 40 });
40 } 41 }
OLDNEW
« no previous file with comments | « pkg/telemetry/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698