Closed Bug 983197 Opened 11 years ago Closed 10 years ago

Test that downloads fail with an HTTP/1.1 response shorter than the Content-Length

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: Paolo, Assigned: Paolo)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch The patch (obsolete) (deleted) — Splinter Review
This patch adds a test in the Downloads API that specifically verifies that a download fails when an HTTP/1.1 response shorter than the Content-Length is received. This depends on the behavior introduced in the HTTP channel in bug 237623. There is no test for success in the HTTP/1.0 case, since backwards compatibility checks are probably more specific to the network layer than downloading behavior.
Attachment #8390585 - Flags: feedback?(dholbert)
Did you request feedback from the wrong person? I'm not familiar with this functionality.
(In reply to Daniel Holbert [:dholbert] from comment #1) > Did you request feedback from the wrong person? I'm not familiar with this > functionality. Sure, wrong feedback flag! Thanks for the prompt reply.
Attachment #8390585 - Flags: feedback?(dholbert) → feedback?(daniel)
Comment on attachment 8390585 [details] [diff] [review] The patch Review of attachment 8390585 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. Do note that patch for bug 237623 that this tests has not yet landed anywhere yet.
Attachment #8390585 - Flags: feedback?(daniel)
Blocks: 983187
No longer depends on: 983187
Attached patch Updated error code (deleted) — Splinter Review
Now that bug 237623 has landed, this test can be added to the Downloads code.
Attachment #8390585 - Attachment is obsolete: true
Attachment #8441355 - Flags: review?(enndeakin)
Comment on attachment 8441355 [details] [diff] [review] Updated error code >+ do_throw("The download should have failed."); >+ } catch (ex if ex instanceof Downloads.Error && ex.becauseSourceFailed) { >+ // A specific error object is thrown when reading from the source fails. >+ } Do you want to verify that an error is indeed thrown here as the comment suggests?
Attachment #8441355 - Flags: review?(enndeakin) → review+
(In reply to Neil Deakin from comment #5) > Comment on attachment 8441355 [details] [diff] [review] > Updated error code > > >+ do_throw("The download should have failed."); > >+ } catch (ex if ex instanceof Downloads.Error && ex.becauseSourceFailed) { > >+ // A specific error object is thrown when reading from the source fails. > >+ } > > Do you want to verify that an error is indeed thrown here as the comment > suggests? Hm, yes, why the question? Is the current comment unclear?
(In reply to :Paolo Amadini from comment #6) > Hm, yes, why the question? Is the current comment unclear? The comment suggests that the test expects an error to be thrown, yet you don't verify that. The catch block does nothing. Are you assuming that other tests have this case covered?
(In reply to Neil Deakin from comment #7) > The comment suggests that the test expects an error to be thrown, yet you > don't verify that. The catch block does nothing. Are you assuming that other > tests have this case covered? The verification is inside the catch line itself: "if ex instanceof Downloads.Error && ex.becauseSourceFailed" That's a convenient way to verify, because if any error that does not match the expected one occurs, it will be automatically passed to the outer exception handler, which will report it in detail including the original stack trace. If the error matches, there is nothing more to do in the catch block.
Makes sense.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: