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

Unified Diff: packages/usage/test/usage_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/usage/test/usage_impl_test.dart ('k') | packages/usage/test/uuid_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/usage/test/usage_test.dart
diff --git a/packages/usage/test/usage_test.dart b/packages/usage/test/usage_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6184f098071e4a682237daf70954b54e06242fbd
--- /dev/null
+++ b/packages/usage/test/usage_test.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2014, 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.
+
+library usage.usage_test;
+
+import 'package:unittest/unittest.dart';
+import 'package:usage/usage.dart';
+
+void defineTests() {
+ group('AnalyticsMock', () {
+ test('simple', () {
+ AnalyticsMock mock = new AnalyticsMock();
+ mock.sendScreenView('main');
+ mock.sendEvent('files', 'save');
+ mock.sendSocial('g+', 'plus', 'userid');
+ mock.sendTiming('compile', 123);
+ mock.startTimer('compile').finish();
+ mock.sendException('FooException');
+ mock.setSessionValue('val', 'ue');
+ return mock.waitForLastPing();
+ });
+ });
+
+ group('sanitizeStacktrace', () {
+ test('replace file', () {
+ expect(sanitizeStacktrace(
+ '(file:///Users/foo/tmp/error.dart:3:13)',
+ shorten: false),
+ '(error.dart:3:13)');
+ });
+
+ test('replace files', () {
+ expect(sanitizeStacktrace(
+ 'foo (file:///Users/foo/tmp/error.dart:3:13)\n'
+ 'bar (file:///Users/foo/tmp/error.dart:3:13)',
+ shorten: false),
+ 'foo (error.dart:3:13)\nbar (error.dart:3:13)');
+ });
+
+ test('shorten 1', () {
+ expect(sanitizeStacktrace(
+ '(file:///Users/foo/tmp/error.dart:3:13)'),
+ '(error.dart:3:13)');
+ });
+
+ test('shorten 2', () {
+ expect(sanitizeStacktrace(
+ 'foo (file:///Users/foo/tmp/error.dart:3:13)\n'
+ 'bar (file:///Users/foo/tmp/error.dart:3:13)'),
+ 'foo (error.dart:3:13) bar (error.dart:3:13)');
+ });
+
+ test('shorten 3', () {
+ expect(sanitizeStacktrace(
+ 'foo (package:foo/foo.dart:3:13)\n'
+ 'bar (dart:async/schedule_microtask.dart:41)'),
+ 'foo (foo/foo.dart:3:13) bar (async/schedule_microtask.dart:41)');
+ });
+ });
+}
« no previous file with comments | « packages/usage/test/usage_impl_test.dart ('k') | packages/usage/test/uuid_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698