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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/telemetry/pubspec.yaml ('k') | pkg/telemetry/test/telemetry_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/telemetry/test/crash_reporting_test.dart
diff --git a/pkg/telemetry/test/crash_reporting_test.dart b/pkg/telemetry/test/crash_reporting_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a6241216ff012c47d200faec41951d6c5a587803
--- /dev/null
+++ b/pkg/telemetry/test/crash_reporting_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:convert' show UTF8;
+
+import 'package:http/http.dart';
+import 'package:http/testing.dart';
+import 'package:telemetry/crash_reporting.dart';
+import 'package:test/test.dart';
+import 'package:usage/usage.dart';
+
+void main() {
+ group('crash_reporting', () {
+ MockClient mockClient;
+
+ Request request;
+
+ setUp(() {
+ mockClient = new MockClient((Request r) async {
+ request = r;
+ return new Response('crash-report-001', 200);
+ });
+ });
+
+ test('CrashReportSender', () async {
+ AnalyticsMock analytics = new AnalyticsMock();
+ CrashReportSender sender =
+ new CrashReportSender(analytics, httpClient: mockClient);
+
+ await sender.sendReport('test-error', stackTrace: StackTrace.current);
+
+ String body = UTF8.decode(request.bodyBytes);
+ expect(body, contains('String')); // error.runtimeType
+ expect(body, contains(analytics.trackingId));
+ expect(body, contains('1.0.0'));
+ expect(body, contains(analytics.clientId));
+ });
+ });
+}
« 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