Chromium Code Reviews| Index: dart_microlytics/test/dart_microlytics_test.dart |
| diff --git a/dart_microlytics/test/dart_microlytics_test.dart b/dart_microlytics/test/dart_microlytics_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8420d6448376f2ec6fe68e67e108df2cb8571654 |
| --- /dev/null |
| +++ b/dart_microlytics/test/dart_microlytics_test.dart |
| @@ -0,0 +1,117 @@ |
| +// 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. |
|
ahe
2014/09/02 13:44:24
Add line between copyright and library declaration
lukechurch
2014/09/02 19:52:37
Done.
|
| +library microlytics.test; |
| + |
| +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
|
| +import '../lib/microlytics.dart'; |
| +import 'test_channel.dart'; |
| + |
| +void main() { |
| + test('Basic event readtest', () { |
| + TestChannel c = new TestChannel(); |
| + AnalyticsLogger logger = new AnalyticsLogger( |
| + c, |
| + "2cfac780-31e2-11e4-8c21-0800200c9a66", |
| + "UA-53895644-1", |
| + "TestApp", |
| + "0.42"); |
| + logger.logAnonymousEvent("video", "play"); |
| + expect(true, c.contains( |
| + "v=1" |
| + "&tid=UA-53895644-1" |
| + "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" |
| + "&t=event" |
| + "&ec=video" |
| + "&ea=play" |
| + "&an=TestApp" |
| + "&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.
|
| + }); |
| + |
| + test('Basic negative event readtest', () { |
| + TestChannel c = new TestChannel(); |
| + AnalyticsLogger logger = new AnalyticsLogger( |
| + c, |
| + "2cfac780-31e2-11e4-8c21-0800200c9a66", |
| + "UA-53895644-1", |
| + "TestApp", |
| + "0.42"); |
| + logger.logAnonymousEvent("video", "play"); |
| + expect(false, c.contains( |
| + "v=1" |
| + "&tid=UA-53895644-1" |
| + "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" |
| + "&t=event" |
| + "&ec=video" |
| + "&ea=play" |
| + "&an=TestApp" |
| + "&av=XXX")); |
| + }); |
| + |
| + test('Basic timing readtest', () { |
| + TestChannel c = new TestChannel(); |
| + AnalyticsLogger logger = new AnalyticsLogger( |
| + c, |
| + "2cfac780-31e2-11e4-8c21-0800200c9a66", |
| + "UA-53895644-1", |
| + "TestApp", |
| + "0.42"); |
| + logger.logAnonymousTiming("video", "delay", 157); |
| + expect(true, c.contains( |
| + "v=1" |
| + "&tid=UA-53895644-1" |
| + "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" |
| + "&t=timing" |
| + "&utc=video" |
| + "&utv=delay" |
| + "&utt=157" |
| + "&an=TestApp" |
| + "&av=0.42" |
| + )); |
| + }); |
| + |
| + test('Basic timing multi readtest', () { |
| + TestChannel c = new TestChannel(); |
| + AnalyticsLogger logger = new AnalyticsLogger( |
| + c, |
| + "2cfac780-31e2-11e4-8c21-0800200c9a66", |
| + "UA-53895644-1", |
| + "TestApp", |
| + "0.42"); |
| + logger.logAnonymousTiming("video", "delay", 159); |
| + logger.logAnonymousTiming("video", "delay", 152); |
| + expect(true, c.contains( |
| + "v=1" |
| + "&tid=UA-53895644-1" |
| + "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" |
| + "&t=timing" |
| + "&utc=video" |
| + "&utv=delay" |
| + "&utt=152" |
| + "&an=TestApp" |
| + "&av=0.42" |
| + )); |
| + expect(true, c.contains( |
| + "v=1" |
| + "&tid=UA-53895644-1" |
| + "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" |
| + "&t=timing" |
| + "&utc=video" |
| + "&utv=delay" |
| + "&utt=159" |
| + "&an=TestApp" |
| + "&av=0.42" |
| + )); |
| + expect(false, c.contains( |
| + "v=1" |
| + "&tid=UA-53895644-1" |
| + "&cid=2cfac780-31e2-11e4-8c21-0800200c9a66" |
| + "&t=timing" |
| + "&utc=video" |
| + "&utv=delay" |
| + "&utt=19" |
| + "&an=TestApp" |
| + "&av=0.42" |
| + )); |
| + }); |
| +} |