Fix WorkerMainScriptLoaderTest.ResponseWithFailureThenOnComplete failure
Currently, when running the unit test WorkerMainScriptLoaderTest.ResponseWithFailureThenOnComplete locally, the result reports all tests passed: [1/1] WorkerMainScriptLoaderTest.ResponseWithFailureThenOnComplete (12 ms) SUCCESS: all tests passed. but actually, there is an error reported: Actual function call count doesn't match EXPECT_CALL(*mock_observer, DidReceiveResponse(_, _, _, _, _)) Expected: to be called once Actual: never called - unsatisfied and active The root cause is that we must execute a forced GC in order to finalize objects depending on the mock object before the test finished, and the test begins to fail consistently after executing a GC in the dtor. Meanwhile, we should call ResourceLoadObserver's DidReceiveResponsei() method before stopping loading the main script by WorkerMainScriptLoader. The WorkerMainScriptLoader class is designed to load the main script for workers, which is pre-requested in browser process and passed to renderer process through WorkerMainScriptLoadParams, and when the http status code indicates a failure, we should notify the |resource_load_observer_| by invoking its DidReceiveResponse() method, thus the devtools could be aware of this response. This patch implements that behavior to make the test runs successfully. Change-Id: I03f062276abad2253b35ebfa4ed8b4f58eddab4f Bug: 1132634 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2433631 Commit-Queue: Minggang Wang <minggang.wang@intel.com> Reviewed-by:Hiroki Nakagawa <nhiroki@chromium.org> Reviewed-by:
Yutaka Hirano <yhirano@chromium.org> Reviewed-by:
Makoto Shimazu <shimazu@chromium.org> Cr-Commit-Position: refs/heads/master@{#811929}
Showing
Please register or sign in to comment