blob: b5ea6c1cb0a1dfb6947581edf24f5e42d9311888 [file] [log] [blame]
// Copyright (c) 2012, 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 XHRTest;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
import 'dart:json';
main() {
useHtmlConfiguration();
test('XHR No file', () {
HttpRequest xhr = new HttpRequest();
xhr.open("GET", "NonExistingFile", true);
xhr.on.readyStateChange.add(expectAsync1((event) {
if (xhr.readyState == HttpRequest.DONE) {
expect(xhr.status, equals(0));
expect(xhr.responseText, equals(''));
}
}));
xhr.send();
});
test('XHR.get No file', () {
new HttpRequest.get("NonExistingFile", expectAsync1((xhr) {
expect(xhr.readyState, equals(HttpRequest.DONE));
expect(xhr.status, equals(0));
expect(xhr.responseText, equals(''));
}));
});
}