Add responseType='arraybuffer' support to XHR
Also moved existing XHR tests from tests/services to tests/framework to better match the location of the XHR code itself. R=ojan@chromium.org Review URL: https://codereview.chromium.org/805503002
This commit is contained in:
parent
325687d810
commit
70a7a3a0ee
@ -1,5 +0,0 @@
|
|||||||
Running 1 tests
|
|
||||||
ok 1 XMLHttpRequest should be able to fetch text files
|
|
||||||
1 tests
|
|
||||||
1 pass
|
|
||||||
0 fail
|
|
@ -1,5 +0,0 @@
|
|||||||
Running 1 tests
|
|
||||||
ok 1 XMLHttpRequest should be able to fetch relative urls
|
|
||||||
1 tests
|
|
||||||
1 pass
|
|
||||||
0 fail
|
|
@ -1,22 +0,0 @@
|
|||||||
<html>
|
|
||||||
<import src="../resources/chai.sky" />
|
|
||||||
<import src="../resources/mocha.sky" />
|
|
||||||
<import src="/sky/framework/xmlhttprequest.sky" as="XMLHttpRequest" />
|
|
||||||
<script>
|
|
||||||
describe('XMLHttpRequest', function() {
|
|
||||||
this.enableTimeouts(false);
|
|
||||||
|
|
||||||
it('should be able to fetch relative urls', function(done) {
|
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.onload = function() {
|
|
||||||
// Also testing that "this" is set correctly in the onload callback.
|
|
||||||
assert.equal(this.responseText, "This is data from the network.\n");
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
xhr.open("GET", "resources/pass.txt");
|
|
||||||
xhr.send();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</html>
|
|
@ -1,25 +0,0 @@
|
|||||||
<html>
|
|
||||||
<import src="../resources/chai.sky" />
|
|
||||||
<import src="../resources/mocha.sky" />
|
|
||||||
<import src="/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/sky/tests/services/resources/pass.txt");
|
|
||||||
xhr.send();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</html>
|
|
Loading…
x
Reference in New Issue
Block a user