aboutsummaryrefslogtreecommitdiffstats
path: root/test/support
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2013-04-26 08:54:43 -0700
committerJames Lal <james@lightsofapollo.com>2013-05-02 14:01:06 -0700
commit8857b80ae0dd7be54d0d731000c9f8edb0434336 (patch)
tree5e7e4ee8dcc3cb01d48b4b88ab14039bc50cf034 /test/support
parent9b6e2c616154f2c20fe6272dca083868c02f98f4 (diff)
downloadjsCalDAV-8857b80ae0dd7be54d0d731000c9f8edb0434336.tar.gz
Bug 867747 - OAuth2 authentication support (particularly for google) r=kgrandon,gaye
Diffstat (limited to 'test/support')
-rw-r--r--test/support/fake_xhr.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/support/fake_xhr.js b/test/support/fake_xhr.js
index 0ffcff8..3f6cea0 100644
--- a/test/support/fake_xhr.js
+++ b/test/support/fake_xhr.js
@@ -1,4 +1,5 @@
(function(module) {
+ console.log('I HAZ LOADED');
function FakeXhr() {
this.openArgs = null;
@@ -14,7 +15,7 @@
FakeXhr.prototype = {
open: function() {
- this.openArgs = arguments;
+ this.openArgs = Array.prototype.slice.call(arguments);
},
getResponseHeader: function(key) {
@@ -26,18 +27,24 @@
},
send: function() {
- this.sendArgs = arguments;
+ this.sendArgs = Array.prototype.slice.call(arguments);
},
- respond: function(data, code) {
+ respond: function(data, code, headers) {
+ if (headers) {
+ this.responseHeaders = headers;
+ } else {
+ this.responseHeaders['content-type'] = 'text/xml';
+ }
+
this.readyState = 4;
- this.responseHeaders['content-type'] = 'text/xml';
this.responseText = data;
this.status = code || 200;
this.onreadystatechange();
}
};
+ console.log('EXPORTS ME', FakeXhr);
module.exports = FakeXhr;
}.apply(