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

Side by Side Diff: tests/html/xhr_test.dart

Issue 19282004: Attempting to fix XHR test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library XHRTest; 5 library XHRTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart'; 7 import '../../pkg/unittest/lib/html_individual_config.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
11 import 'dart:typed_data'; 11 import 'dart:typed_data';
12 12
13 void fail(message) { 13 void fail(message) {
14 guardAsync(() { 14 guardAsync(() {
15 expect(false, isTrue, reason: message); 15 expect(false, isTrue, reason: message);
16 }); 16 });
17 } 17 }
18 18
19 main() { 19 main() {
20 useHtmlIndividualConfiguration(); 20 useHtmlIndividualConfiguration();
21 var url = "/root_dart/tests/html/xhr_cross_origin_data.txt"; 21 // Cache blocker is a workaround for:
22 // https://code.google.com/p/dart/issues/detail?id=11834
23 var cacheBlocker = new DateTime.now().millisecondsSinceEpoch;
24 var url = '/root_dart/tests/html/xhr_cross_origin_data.txt?'
25 'cacheBlock=$cacheBlocker';
22 26
23 void validate200Response(xhr) { 27 void validate200Response(xhr) {
24 expect(xhr.status, equals(200)); 28 expect(xhr.status, equals(200));
25 var data = json.parse(xhr.responseText); 29 var data = json.parse(xhr.responseText);
26 expect(data, contains('feed')); 30 expect(data, contains('feed'));
27 expect(data['feed'], contains('entry')); 31 expect(data['feed'], contains('entry'));
28 expect(data, isMap); 32 expect(data, isMap);
29 } 33 }
30 34
31 void validate404(xhr) { 35 void validate404(xhr) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 (xhr) { 217 (xhr) {
214 expect(xhr.status, equals(200)); 218 expect(xhr.status, equals(200));
215 var blob = xhr.response; 219 var blob = xhr.response;
216 expect(blob is Blob, isTrue); 220 expect(blob is Blob, isTrue);
217 expect(blob, isNotNull); 221 expect(blob, isNotNull);
218 }); 222 });
219 } 223 }
220 }); 224 });
221 }); 225 });
222 } 226 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698