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

Unified Diff: tests/html/form_data_test.dart

Issue 11678011: Adding test for validating that formdata is sent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « no previous file | tools/testing/dart/http_server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/form_data_test.dart
diff --git a/tests/html/form_data_test.dart b/tests/html/form_data_test.dart
index 6ea53810970239f06301717ad1c3bdba4d55b09f..a8b96fd43b14ca8630923d0af8fb10e9cfd8882f 100644
--- a/tests/html/form_data_test.dart
+++ b/tests/html/form_data_test.dart
@@ -8,6 +8,12 @@ import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
+void fail(message) {
+ guardAsync(() {
+ expect(false, isTrue, reason: message);
+ });
+}
+
void main() {
// TODO(efortuna): This is a bad test. Revisit when we have tests that can run
// both a server and fire up a browser.
@@ -43,4 +49,24 @@ void main() {
'text/plain');
form.append('theBlob', blob, 'theBlob.txt');
});
+
+ test('send', () {
+ var form = new FormData();
+ var blobString = 'Indescribable... Indestructible! Nothing can stop it!';
+ var blob = new Blob(
+ [blobString],
+ 'text/plain');
+ form.append('theBlob', blob, 'theBlob.txt');
+
+ var xhr = new HttpRequest();
+ xhr.open("POST", "http://localhost:9876/echo");
+
+ xhr.on.load.add(expectAsync1((e) {
+ expect(xhr.responseText.contains(blobString), true);
+ }));
+ xhr.on.error.add((e) {
+ fail('$e');
+ });
+ xhr.send(form);
+ });
}
« no previous file with comments | « no previous file | tools/testing/dart/http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698