service worker: Simplify ServiceWorkerNavigationLoader states.

* Remove the Cancelled state so there is only one Completed state.
  The Cancellation state was previously reached by Mojo connection
  error. But it's not needed since WasCanceled() only gets called by
  ServiceWorkerControlleeRequestHandler prior to StartRequest(), which
  means the Mojo connection is not yet established.
* Funnel "cancellation" to CommitCompleted() so there's less transitions
  to Completed.
* Add a unit test about Mojo connection error while the fetch dispatcher
  is alive. Note that the current code passed this test also. The
  test would fail if the InvalidateWeakPtrs() and
  fetch_dispatcher_.reset() lines are removed from the connection
  error handler.

Bug: 715640
Change-Id: Ibac22ceea5dbc2c11ae7c7d3c47e21cfb9a6d393
Reviewed-on: https://chromium-review.googlesource.com/1198650
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587982}
5 files changed