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

Side by Side Diff: packages/usage/test/web_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/usage/test/uuid_test.dart ('k') | packages/usage/tool/drone.sh » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 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 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 @TestOn("browser") 5 @TestOn("browser")
6 library usage.web_test; 6 library usage.web_test;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:html';
9 10
10 import 'package:test/test.dart'; 11 import 'package:test/test.dart';
11 import 'package:usage/src/usage_impl_html.dart'; 12 import 'package:usage/src/usage_impl_html.dart';
12 13
13 import 'hit_types_test.dart' as hit_types_test; 14 import 'hit_types_test.dart' as hit_types_test;
14 import 'usage_impl_test.dart' as usage_impl_test; 15 import 'usage_impl_test.dart' as usage_impl_test;
15 import 'usage_test.dart' as usage_test; 16 import 'usage_test.dart' as usage_test;
16 import 'uuid_test.dart' as uuid_test; 17 import 'uuid_test.dart' as uuid_test;
17 18
18 void main() { 19 void main() {
19 // Define the tests. 20 // Define the tests.
20 hit_types_test.defineTests(); 21 hit_types_test.defineTests();
21 usage_test.defineTests(); 22 usage_test.defineTests();
22 usage_impl_test.defineTests(); 23 usage_impl_test.defineTests();
23 uuid_test.defineTests(); 24 uuid_test.defineTests();
24 25
25 // Define some web specfic tests. 26 // Define some web specific tests.
26 defineWebTests(); 27 defineWebTests();
27 } 28 }
28 29
29 void defineWebTests() { 30 void defineWebTests() {
30 group('HtmlPostHandler', () { 31 group('HtmlPostHandler', () {
31 test('sendPost', () { 32 test('sendPost', () async {
32 MockRequestor client = new MockRequestor(); 33 MockRequestor client = new MockRequestor();
33 HtmlPostHandler postHandler = new HtmlPostHandler( 34 HtmlPostHandler postHandler =
34 mockRequestor: client.request); 35 new HtmlPostHandler(mockRequestor: client.request);
35 Map args = {'utv': 'varName', 'utt': 123}; 36 Map<String, dynamic> args = {'utv': 'varName', 'utt': 123};
36 return postHandler.sendPost('http://www.google.com', args).then((_) { 37
37 expect(client.sendCount, 1); 38 await postHandler.sendPost('http://www.google.com', args);
38 }); 39 expect(client.sendCount, 1);
39 }); 40 });
40 }); 41 });
41 42
42 group('HtmlPersistentProperties', () { 43 group('HtmlPersistentProperties', () {
43 test('add', () { 44 test('add', () {
44 HtmlPersistentProperties props = new HtmlPersistentProperties('foo_props') ; 45 HtmlPersistentProperties props =
46 new HtmlPersistentProperties('foo_props');
45 props['foo'] = 'bar'; 47 props['foo'] = 'bar';
46 expect(props['foo'], 'bar'); 48 expect(props['foo'], 'bar');
47 }); 49 });
48 50
49 test('remove', () { 51 test('remove', () {
50 HtmlPersistentProperties props = new HtmlPersistentProperties('foo_props') ; 52 HtmlPersistentProperties props =
53 new HtmlPersistentProperties('foo_props');
51 props['foo'] = 'bar'; 54 props['foo'] = 'bar';
52 expect(props['foo'], 'bar'); 55 expect(props['foo'], 'bar');
53 props['foo'] = null; 56 props['foo'] = null;
54 expect(props['foo'], null); 57 expect(props['foo'], null);
55 }); 58 });
56 }); 59 });
57 } 60 }
58 61
59 class MockRequestor { 62 class MockRequestor {
60 int sendCount = 0; 63 int sendCount = 0;
61 64
62 Future request(String url, {String method, String sendData}) { 65 Future<HttpRequest> request(String url, {String method, sendData}) {
63 expect(url, isNotEmpty); 66 expect(url, isNotEmpty);
64 expect(method, isNotEmpty); 67 expect(method, isNotEmpty);
65 expect(sendData, isNotEmpty); 68 expect(sendData, isNotEmpty);
66 69
67 sendCount++; 70 sendCount++;
68 return new Future.value(); 71 return new Future.value();
69 } 72 }
70 } 73 }
OLDNEW
« no previous file with comments | « packages/usage/test/uuid_test.dart ('k') | packages/usage/tool/drone.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698