[OpenLayers-Commits] r10904 - trunk/openlayers/tests
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Nov 18 08:39:08 EST 2010
Author: erilem
Date: 2010-11-18 05:39:08 -0800 (Thu, 18 Nov 2010)
New Revision: 10904
Modified:
trunk/openlayers/tests/Request.html
Log:
make Request.html pass again, it passes in Chrome7, IE7 and FF3, no functional change
Modified: trunk/openlayers/tests/Request.html
===================================================================
--- trunk/openlayers/tests/Request.html 2010-11-17 12:51:22 UTC (rev 10903)
+++ trunk/openlayers/tests/Request.html 2010-11-18 13:39:08 UTC (rev 10904)
@@ -372,19 +372,41 @@
}
function test_abort(t) {
+
t.plan(0);
- var fail = false;
- OpenLayers.Request.XMLHttpRequest.onsend = function(args) {
- fail = true;
- }
+
+ var sendCalled;
+
+ // set up
+
+ var _open = OpenLayers.Request.XMLHttpRequest.prototype.open;
+ OpenLayers.Request.XMLHttpRequest.prototype.open = function() {
+ this.readyState = OpenLayers.Request.XMLHttpRequest.OPENED;
+ };
+
+ var _setRequestHeader = OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader;
+ OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader = function() {};
+
+ var _send = OpenLayers.Request.XMLHttpRequest.prototype.send;
+ OpenLayers.Request.XMLHttpRequest.prototype.send = function() {
+ sendCalled = true;
+ };
+
+ // test
+
+ sendCalled = false;
+ OpenLayers.Request.issue().abort();
+
t.delay_call(0.5, function() {
- if (fail === true) {
+ if (sendCalled) {
t.fail("Send should not be called because request is aborted");
}
- OpenLayers.Request.XMLHttpRequest.onsend = null;
+
+ // tear down
+ OpenLayers.Request.XMLHttpRequest.prototype.open = _open;
+ OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader = _setRequestHeader;
+ OpenLayers.Request.XMLHttpRequest.prototype.send = _send;
});
- var protocol = new OpenLayers.Protocol.HTTP();
- protocol.abort(protocol.read());
}
</script>
More information about the Commits
mailing list