do_check_eq(data, rangeBody.substring(1)); 
do_check_eq(data, rangeBody); 
function run_test() {  dump("*** run_test\n");  httpserver = new nsHttpServer();  httpserver.registerPathHandler("/auth", authHandler);  httpserver.registerPathHandler("/range", rangeHandler);  httpserver.registerPathHandler("/redir", redirHandler);  var entityID;  function get_entity_id(request, data, ctx) {    do_check_true(request instanceof Ci.nsIResumableChannel,                  "must be a resumable channel");    entityID = request.entityID;    dump("*** entity id = " + entityID + "\n");    // Try a non-resumable URL (responds with 200)    var chan = make_channel("http://localhost:4444/");    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.asyncOpen(new ChannelListener(try_resume, null, CL_EXPECT_FAILURE), null);  }  function try_resume(request, data, ctx) {    do_check_eq(request.status, NS_ERROR_NOT_RESUMABLE);    // Try a successful resume    var chan = make_channel("http://localhost:4444/range");    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.asyncOpen(new ChannelListener(success, null), null);  }  function success(request, data, ctx) {    do_check_true(request.nsIHttpChannel.requestSucceeded);    do_check_eq(data, rangeBody.substring(1));    // Authentication (no password; working resume)    // (should not give us any data)    var chan = make_channel("http://localhost:4444/range");    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.nsIHttpChannel.setRequestHeader("X-Need-Auth", "true", false);    chan.asyncOpen(new ChannelListener(test_auth_nopw, null, CL_EXPECT_FAILURE), null);  }  function test_auth_nopw(request, data, ctx) {    do_check_false(request.nsIHttpChannel.requestSucceeded);    do_check_eq(request.status, NS_ERROR_ENTITY_CHANGED);    // Authentication + not working resume    var chan = make_channel("http://localhost:4444/auth");    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.notificationCallbacks = new Requestor();    chan.asyncOpen(new ChannelListener(test_auth, null, CL_EXPECT_FAILURE), null);  }  function test_auth(request, data, ctx) {    do_check_eq(request.status, NS_ERROR_NOT_RESUMABLE);    do_check_true(request.nsIHttpChannel.responseStatus < 300);    // Authentication + working resume    var chan = make_channel("http://localhost:4444/range");    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.notificationCallbacks = new Requestor();    chan.nsIHttpChannel.setRequestHeader("X-Need-Auth", "true", false);    chan.asyncOpen(new ChannelListener(test_auth_resume, null), null);  }  function test_auth_resume(request, data, ctx) {    do_check_eq(data, rangeBody.substring(1));    do_check_true(request.nsIHttpChannel.requestSucceeded);    // 404 page (same content length as real content)    var chan = make_channel("http://localhost:4444/range");    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.nsIHttpChannel.setRequestHeader("X-Want-404", "true", false);    chan.asyncOpen(new ChannelListener(test_404, null, CL_EXPECT_FAILURE), null);  }  function test_404(request, data, ctx) {    do_check_eq(request.status, NS_ERROR_ENTITY_CHANGED);    do_check_eq(request.nsIHttpChannel.responseStatus, 404);    // 416 Requested Range Not Satisfiable    var chan = make_channel("http://localhost:4444/range");    chan.nsIResumableChannel.resumeAt(1000, entityID);    chan.asyncOpen(new ChannelListener(test_416, null, CL_EXPECT_FAILURE), null);  }  function test_416(request, data, ctx) {    do_check_eq(request.status, NS_ERROR_ENTITY_CHANGED);    do_check_eq(request.nsIHttpChannel.responseStatus, 416);    // Redirect + successful resume    var chan = make_channel("http://localhost:4444/redir");    chan.nsIHttpChannel.setRequestHeader("X-Redir-To", "http://localhost:4444/range", false);    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.asyncOpen(new ChannelListener(test_redir_resume, null), null);  }  function test_redir_resume(request, data, ctx) {    do_check_true(request.nsIHttpChannel.requestSucceeded);    do_check_eq(data, rangeBody.substring(1));    do_check_eq(request.nsIHttpChannel.responseStatus, 206);    // Redirect + failed resume    var chan = make_channel("http://localhost:4444/redir");    chan.nsIHttpChannel.setRequestHeader("X-Redir-To", "http://localhost:4444/", false);    chan.nsIResumableChannel.resumeAt(1, entityID);    chan.asyncOpen(new ChannelListener(test_redir_noresume, null, CL_EXPECT_FAILURE), null);  }  function test_redir_noresume(request, data, ctx) {    do_check_eq(request.status, NS_ERROR_NOT_RESUMABLE);    httpserver.stop();    do_test_finished();  }  httpserver.start(4444);  var chan = make_channel("http://localhost:4444/range");  chan.asyncOpen(new ChannelListener(get_entity_id, null), null);  do_test_pending();}
5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5459/a89e8709953493b59975e6727d67f027f1078f94/test_resumable_channel.js/clean/netwerk/test/unit/test_resumable_channel.js