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

Side by Side Diff: dart_microlytics/test/dart_microlytics_test.dart

Issue 515993003: Minimalistic analytics library used by Dart Server and try.dartlang.org (Closed) Base URL: https://github.com/lukechurch/dart-mircolytics.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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.
ahe 2014/09/02 13:44:24 Add line between copyright and library declaration
lukechurch 2014/09/02 19:52:37 Done.
4 library microlytics.test;
5
6 import 'package:unittest/unittest.dart';
ahe 2014/09/02 13:44:24 We need to discuss this. I'm of the opinion that u
lukechurch 2014/09/02 19:52:37 Understood. Lets talk tomorrow
7 import '../lib/microlytics.dart';
8 import 'test_channel.dart';
9
10 void main() {
11 test('Basic event readtest', () {
12 TestChannel c = new TestChannel();
13 AnalyticsLogger logger = new AnalyticsLogger(
14 c,
15 "2cfac780-31e2-11e4-8c21-0800200c9a66",
16 "UA-53895644-1",
17 "TestApp",
18 "0.42");
19 logger.logAnonymousEvent("video", "play");
20 expect(true, c.contains(
21 "v=1"
22 "&tid=UA-53895644-1"
23 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
24 "&t=event"
25 "&ec=video"
26 "&ea=play"
27 "&an=TestApp"
28 "&av=0.42"));
ahe 2014/09/02 13:44:24 This code seem to to serve only the purpose of ens
lukechurch 2014/09/02 19:52:37 I agree. I think this will be make more sense when
ahe 2014/09/03 08:51:31 The basic problem is that the HttpX channels aren'
lukechurch 2014/09/03 11:27:17 Acknowledged.
29 });
30
31 test('Basic negative event readtest', () {
32 TestChannel c = new TestChannel();
33 AnalyticsLogger logger = new AnalyticsLogger(
34 c,
35 "2cfac780-31e2-11e4-8c21-0800200c9a66",
36 "UA-53895644-1",
37 "TestApp",
38 "0.42");
39 logger.logAnonymousEvent("video", "play");
40 expect(false, c.contains(
41 "v=1"
42 "&tid=UA-53895644-1"
43 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
44 "&t=event"
45 "&ec=video"
46 "&ea=play"
47 "&an=TestApp"
48 "&av=XXX"));
49 });
50
51 test('Basic timing readtest', () {
52 TestChannel c = new TestChannel();
53 AnalyticsLogger logger = new AnalyticsLogger(
54 c,
55 "2cfac780-31e2-11e4-8c21-0800200c9a66",
56 "UA-53895644-1",
57 "TestApp",
58 "0.42");
59 logger.logAnonymousTiming("video", "delay", 157);
60 expect(true, c.contains(
61 "v=1"
62 "&tid=UA-53895644-1"
63 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
64 "&t=timing"
65 "&utc=video"
66 "&utv=delay"
67 "&utt=157"
68 "&an=TestApp"
69 "&av=0.42"
70 ));
71 });
72
73 test('Basic timing multi readtest', () {
74 TestChannel c = new TestChannel();
75 AnalyticsLogger logger = new AnalyticsLogger(
76 c,
77 "2cfac780-31e2-11e4-8c21-0800200c9a66",
78 "UA-53895644-1",
79 "TestApp",
80 "0.42");
81 logger.logAnonymousTiming("video", "delay", 159);
82 logger.logAnonymousTiming("video", "delay", 152);
83 expect(true, c.contains(
84 "v=1"
85 "&tid=UA-53895644-1"
86 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
87 "&t=timing"
88 "&utc=video"
89 "&utv=delay"
90 "&utt=152"
91 "&an=TestApp"
92 "&av=0.42"
93 ));
94 expect(true, c.contains(
95 "v=1"
96 "&tid=UA-53895644-1"
97 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
98 "&t=timing"
99 "&utc=video"
100 "&utv=delay"
101 "&utt=159"
102 "&an=TestApp"
103 "&av=0.42"
104 ));
105 expect(false, c.contains(
106 "v=1"
107 "&tid=UA-53895644-1"
108 "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
109 "&t=timing"
110 "&utc=video"
111 "&utv=delay"
112 "&utt=19"
113 "&an=TestApp"
114 "&av=0.42"
115 ));
116 });
117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698