Add a basic XMLHttpRequest implementation
R=esprehn@chromium.org Review URL: https://codereview.chromium.org/690803002
This commit is contained in:
5
engine/src/flutter/tests/services/xhr-expected.txt
Normal file
5
engine/src/flutter/tests/services/xhr-expected.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Running 1 tests
|
||||
ok 1 XMLHttpRequest should be able to fetch text files
|
||||
1 tests
|
||||
1 pass
|
||||
0 fail
|
||||
25
engine/src/flutter/tests/services/xhr.sky
Normal file
25
engine/src/flutter/tests/services/xhr.sky
Normal file
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<link rel="import" href="../resources/chai.sky" />
|
||||
<link rel="import" href="../resources/mocha.sky" />
|
||||
<link rel="import" href="/sky/framework/xmlhttprequest.sky" as="XMLHttpRequest" />
|
||||
<script>
|
||||
describe('XMLHttpRequest', function() {
|
||||
this.enableTimeouts(false);
|
||||
|
||||
it('should be able to fetch text files', function(done) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function() {
|
||||
assert.equal(xhr.responseText, "This is data from the network.\n");
|
||||
done();
|
||||
};
|
||||
xhr.onerror = function(error) {
|
||||
assert.ok(false, "Got error: " + JSON.stringify(error));
|
||||
done();
|
||||
};
|
||||
xhr.open("GET", "http://127.0.0.1:8000/services/resources/pass.txt");
|
||||
xhr.send();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user