Change WebURLLoaderMockFactory for future FOUC tests in blink.

In future FOUC unit tests blink will need to control the responses of
network requests. This means blink may buffer the calls to
didReceiveResponse, didReceiveData, didFail and didFinishLoading.

To enable this we need to make it not an error to cancel() a load that
doesn't exist. This is because ServeAsynchronousRequests will always
do pending_loaders_.erase(loader); even if the request was actually
buffered inside blink. That means later when blink replays the
callbacks the request will already have been removed from
pending_loaders_ when blink calls cancel() and then this would crash.

I also updated ReadFile to support loading empty paths instead of
needing to load an empty.txt file. This is because blink is going to
simulate the response data in chunks and not actually load it from
files.

BUG=521692
R=dcheng@chromium.org

Review URL: https://codereview.chromium.org/1310153003

Cr-Commit-Position: refs/heads/master@{#345748}
2 files changed