| Index: tests/html/xhr_test.dart
|
| diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart
|
| index 64a1828ec967f54c83963354baef5cdb3fdfd86a..c5d16a3287f550218061305821566093f914565a 100644
|
| --- a/tests/html/xhr_test.dart
|
| +++ b/tests/html/xhr_test.dart
|
| @@ -4,12 +4,12 @@
|
|
|
| library XHRTest;
|
| import '../../pkg/unittest/lib/unittest.dart';
|
| -import '../../pkg/unittest/lib/html_config.dart';
|
| +import '../../pkg/unittest/lib/html_individual_config.dart';
|
| import 'dart:html';
|
| import 'dart:json' as json;
|
|
|
| main() {
|
| - useHtmlConfiguration();
|
| + useHtmlIndividualConfiguration();
|
| var url = "/tests/html/xhr_cross_origin_data.txt";
|
|
|
| void validate200Response(xhr) {
|
| @@ -25,53 +25,70 @@ main() {
|
| expect(xhr.responseText, equals(''));
|
| }
|
|
|
| - test('XHR No file', () {
|
| - HttpRequest xhr = new HttpRequest();
|
| - xhr.open("GET", "NonExistingFile", true);
|
| - xhr.on.readyStateChange.add(expectAsyncUntil1((event) {
|
| - if (xhr.readyState == HttpRequest.DONE) {
|
| - validate404(xhr);
|
| - }
|
| - }, () => xhr.readyState == HttpRequest.DONE));
|
| - xhr.send();
|
| + group('supported_HttpRequestProgressEvent', () {
|
| + test('supported', () {
|
| + expect(HttpRequestProgressEvent.supported, isTrue);
|
| + });
|
| });
|
|
|
| - test('XHR file', () {
|
| - var xhr = new HttpRequest();
|
| - xhr.open('GET', url, true);
|
| - xhr.on.readyStateChange.add(expectAsyncUntil1((e) {
|
| - if (xhr.readyState == HttpRequest.DONE) {
|
| - validate200Response(xhr);
|
| - }
|
| - }, () => xhr.readyState == HttpRequest.DONE));
|
| - xhr.send();
|
| - });
|
| + group('xhr', () {
|
| + test('XHR No file', () {
|
| + HttpRequest xhr = new HttpRequest();
|
| + xhr.open("GET", "NonExistingFile", true);
|
| + xhr.on.readyStateChange.add(expectAsyncUntil1((event) {
|
| + if (xhr.readyState == HttpRequest.DONE) {
|
| + validate404(xhr);
|
| + }
|
| + }, () => xhr.readyState == HttpRequest.DONE));
|
| + xhr.send();
|
| + });
|
|
|
| - test('XHR.get No file', () {
|
| - new HttpRequest.get("NonExistingFile", expectAsync1((xhr) {
|
| - expect(xhr.readyState, equals(HttpRequest.DONE));
|
| - validate404(xhr);
|
| - }));
|
| - });
|
| + test('XHR file', () {
|
| + var xhr = new HttpRequest();
|
| + xhr.open('GET', url, true);
|
| + xhr.on.readyStateChange.add(expectAsyncUntil1((e) {
|
| + if (xhr.readyState == HttpRequest.DONE) {
|
| + validate200Response(xhr);
|
| + }
|
| + }, () => xhr.readyState == HttpRequest.DONE));
|
| + xhr.send();
|
| + });
|
|
|
| - test('XHR.get file', () {
|
| - var xhr = new HttpRequest.get(url, expectAsync1((event) {
|
| - expect(event.readyState, equals(HttpRequest.DONE));
|
| - validate200Response(event);
|
| - }));
|
| - });
|
| + test('XHR.get No file', () {
|
| + new HttpRequest.get("NonExistingFile", expectAsync1((xhr) {
|
| + expect(xhr.readyState, equals(HttpRequest.DONE));
|
| + validate404(xhr);
|
| + }));
|
| + });
|
|
|
| - test('XHR.getWithCredentials No file', () {
|
| - new HttpRequest.getWithCredentials("NonExistingFile", expectAsync1((xhr) {
|
| - expect(xhr.readyState, equals(HttpRequest.DONE));
|
| - validate404(xhr);
|
| - }));
|
| - });
|
| + test('XHR.get file', () {
|
| + var xhr = new HttpRequest.get(url, expectAsync1((event) {
|
| + expect(event.readyState, equals(HttpRequest.DONE));
|
| + validate200Response(event);
|
| + }));
|
| + });
|
| +
|
| + test('XHR.getWithCredentials No file', () {
|
| + new HttpRequest.getWithCredentials("NonExistingFile", expectAsync1((xhr) {
|
| + expect(xhr.readyState, equals(HttpRequest.DONE));
|
| + validate404(xhr);
|
| + }));
|
| + });
|
| +
|
| + test('XHR.getWithCredentials file', () {
|
| + new HttpRequest.getWithCredentials(url, expectAsync1((xhr) {
|
| + expect(xhr.readyState, equals(HttpRequest.DONE));
|
| + validate200Response(xhr);
|
| + }));
|
| + });
|
|
|
| - test('XHR.getWithCredentials file', () {
|
| - new HttpRequest.getWithCredentials(url, expectAsync1((xhr) {
|
| - expect(xhr.readyState, equals(HttpRequest.DONE));
|
| - validate200Response(xhr);
|
| - }));
|
| + test('HttpRequestProgressEvent', () {
|
| + var expectation = HttpRequestProgressEvent.supported ?
|
| + returnsNormally : throws;
|
| + expect(() {
|
| + var event = new Event.eventType('XMLHttpRequestProgressEvent', '');
|
| + expect(event is HttpRequestProgressEvent, isTrue);
|
| + }, expectation);
|
| + });
|
| });
|
| }
|
|
|