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

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

Issue 226903002: tests/html: removed usage of deprecated unittest features (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/html/websql_test.dart ('k') | tests/html/xhr_test.dart » ('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) 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 XHRCrossOriginTest; 5 library XHRCrossOriginTest;
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:html'; 8 import 'dart:html';
9 import "dart:convert"; 9 import "dart:convert";
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 test('XHR Cross-domain', () { 83 test('XHR Cross-domain', () {
84 var url = '$host/root_dart/tests/html/xhr_cross_origin_data.txt'; 84 var url = '$host/root_dart/tests/html/xhr_cross_origin_data.txt';
85 var xhr = new HttpRequest(); 85 var xhr = new HttpRequest();
86 xhr.open('GET', url, async: true); 86 xhr.open('GET', url, async: true);
87 var validate = expectAsync((data) { 87 var validate = expectAsync((data) {
88 expect(data, contains('feed')); 88 expect(data, contains('feed'));
89 expect(data['feed'], contains('entry')); 89 expect(data['feed'], contains('entry'));
90 expect(data, isMap); 90 expect(data, isMap);
91 }); 91 });
92 xhr.onReadyStateChange.listen((e) { 92 xhr.onReadyStateChange.listen((e) {
93 guardAsync(() { 93 if (xhr.readyState == HttpRequest.DONE) {
94 if (xhr.readyState == HttpRequest.DONE) { 94 validate(JSON.decode(xhr.response));
95 validate(JSON.decode(xhr.response)); 95 }
96 }
97 });
98 }); 96 });
99 xhr.send(); 97 xhr.send();
100 }); 98 });
101 99
102 test('XHR.getWithCredentials Cross-domain', () { 100 test('XHR.getWithCredentials Cross-domain', () {
103 var url = '$host/root_dart/tests/html/xhr_cross_origin_data.txt'; 101 var url = '$host/root_dart/tests/html/xhr_cross_origin_data.txt';
104 return HttpRequest.request(url, withCredentials: true).then((xhr) { 102 return HttpRequest.request(url, withCredentials: true).then((xhr) {
105 var data = JSON.decode(xhr.response); 103 var data = JSON.decode(xhr.response);
106 expect(data, contains('feed')); 104 expect(data, contains('feed'));
107 expect(data['feed'], contains('entry')); 105 expect(data['feed'], contains('entry'));
108 expect(data, isMap); 106 expect(data, isMap);
109 }); 107 });
110 }); 108 });
111 }); 109 });
112 } 110 }
OLDNEW
« no previous file with comments | « tests/html/websql_test.dart ('k') | tests/html/xhr_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698