Add a basic XMLHttpRequest implementation

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/690803002
This commit is contained in:
Adam Barth
2014-10-29 12:48:16 -07:00
parent 3d85f63717
commit f1aae9495a
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
Running 1 tests
ok 1 XMLHttpRequest should be able to fetch text files
1 tests
1 pass
0 fail

View 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>