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

Unified Diff: packages/usage/test/web_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/web.html ('k') | packages/usage/tool/drone.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/usage/test/web_test.dart
diff --git a/packages/usage/test/web_test.dart b/packages/usage/test/web_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0b79e898dfb924fcc6d445d92524d2cef5c9a247
--- /dev/null
+++ b/packages/usage/test/web_test.dart
@@ -0,0 +1,73 @@
+// 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.web_test;
+
+import 'dart:async';
+
+import 'package:grinder/src/webtest.dart';
+import 'package:usage/src/usage_impl_html.dart';
+import 'package:unittest/unittest.dart';
+
+import 'hit_types_test.dart' as hit_types_test;
+import 'usage_test.dart' as usage_test;
+import 'usage_impl_test.dart' as usage_impl_test;
+import 'uuid_test.dart' as uuid_test;
+
+void main() {
+ // Set up the test environment.
+ WebTestConfiguration.setupTestEnvironment();
+
+ // Define the tests.
+ hit_types_test.defineTests();
+ usage_test.defineTests();
+ usage_impl_test.defineTests();
+ uuid_test.defineTests();
+
+ // Define some web specfic tests.
+ defineWebTests();
+}
+
+void defineWebTests() {
+ group('HtmlPostHandler', () {
+ test('sendPost', () {
+ MockRequestor client = new MockRequestor();
+ HtmlPostHandler postHandler = new HtmlPostHandler(
+ mockRequestor: client.request);
+ Map args = {'utv': 'varName', 'utt': 123};
+ return postHandler.sendPost('http://www.google.com', args).then((_) {
+ expect(client.sendCount, 1);
+ });
+ });
+ });
+
+ group('HtmlPersistentProperties', () {
+ test('add', () {
+ HtmlPersistentProperties props = new HtmlPersistentProperties('foo_props');
+ props['foo'] = 'bar';
+ expect(props['foo'], 'bar');
+ });
+
+ test('remove', () {
+ HtmlPersistentProperties props = new HtmlPersistentProperties('foo_props');
+ props['foo'] = 'bar';
+ expect(props['foo'], 'bar');
+ props['foo'] = null;
+ expect(props['foo'], null);
+ });
+ });
+}
+
+class MockRequestor {
+ int sendCount = 0;
+
+ Future request(String url, {String method, String sendData}) {
+ expect(url, isNotEmpty);
+ expect(method, isNotEmpty);
+ expect(sendData, isNotEmpty);
+
+ sendCount++;
+ return new Future.value();
+ }
+}
« no previous file with comments | « packages/usage/test/web.html ('k') | packages/usage/tool/drone.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698