Add ability to observe FileDataPipeProducer's unexpected shutdown.

Call FileDataPipeProducer::Observer::OnBytesRead before calling
OnDoneReading if there is an error. This allows observers to
detect errors like read failures that occur when FileDataPipeProducer
shuts down before it completes.

With network service, extensions could see
FileDataPipeProducer::Observer::OnDoneReading without any read error
through OnBytesRead when FileDataPipeProducer is shut down (in
the middle?). This happens when an extension has (large sized) file
requests in flight and the extension is disabled/enabled rapidly.
To make it possible that extensions system knows about the error,
this CL adds a bool status to OnDoneReading.

Without this CL, ContentVerifyJob incorrectly thinks that the
content read is successful with truncated content of the file as it
sees some OnBytesRead without any errors and then it sees
OnDoneReading. This leads to (incorrect) content verification failure
that disables the extension. This CL checks for the status of
OnBytesRead and ignores content verification if an error was seen
due to unexpected file read errors.

This CL adds a regression test for this.

Bug: 977805
Test: See bug description for repro steps.
Change-Id: I72b1922d325797623fb6bd201b64de699e6c4d10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1684506
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676736}
11 files changed