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

Unified Diff: test/codegen/lib/html/resource_http_test.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 years, 8 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 | « test/codegen/lib/html/resource_data.txt ('k') | test/codegen/lib/html/rtc_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/lib/html/resource_http_test.dart
diff --git a/test/codegen/lib/html/resource_http_test.dart b/test/codegen/lib/html/resource_http_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..042e8b395b0856b463a8fe9573d8e8548d7ba172
--- /dev/null
+++ b/test/codegen/lib/html/resource_http_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2015, 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 resource_http_test;
+import 'dart:async';
+import 'package:unittest/html_individual_config.dart';
+import 'package:unittest/unittest.dart';
+
+main() {
+ useHtmlIndividualConfiguration();
+ // Cache blocker is a workaround for:
+ // https://code.google.com/p/dart/issues/detail?id=11834
+ var cacheBlocker = new DateTime.now().millisecondsSinceEpoch;
+ var url = '/root_dart/tests/html/resource_data.txt?cacheBlock=$cacheBlocker';
+
+ void validateResponse(data) {
+ expect(data, equals('This file was read by a Resource!'));
+ }
+
+ group('resource', () {
+ test('readAsString', () async {
+ Resource r = new Resource(url);
+ var data = await r.readAsString();
+ validateResponse(data);
+ });
+ test('readAsBytes', () async {
+ Resource r = new Resource(url);
+ var data = await r.readAsBytes();
+ validateResponse(new String.fromCharCodes(data));
+ });
+ test('openRead', () async {
+ Resource r = new Resource(url);
+ var bytes = [];
+ await for (var b in r.openRead()) {
+ bytes.addAll(b);
+ }
+ validateResponse(new String.fromCharCodes(bytes));
+ });
+ });
+}
« no previous file with comments | « test/codegen/lib/html/resource_data.txt ('k') | test/codegen/lib/html/rtc_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698