Rewrite flaky CancelBeforeUnloadResetsURL test and update fix.

We can invalidate the URL in the address bar without waiting for the
beforeunload ACK from the renderer, making the test easier to write.
We're keeping the invalidation in DidCancelLoading after the ACK as
well, since it's not clear whether that's safe to remove.

Also, the test can be implemented in content/ rather than chrome/.

BUG=739773
TEST=No behavior change, new test stays green.

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I66450965b5a8ac517211194590f47044d6ab50d3
Reviewed-on: https://chromium-review.googlesource.com/750330
Reviewed-by: Nate Chapin <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Charlie Reis <[email protected]>
Cr-Commit-Position: refs/heads/master@{#513826}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 32d969bd..41839f8 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5696,6 +5696,9 @@
       controller_.DiscardNonCommittedEntries();
     }
 
+    // Update the URL display either way, to avoid showing a stale URL.
+    NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
+
     for (auto& observer : observers_)
       observer.BeforeUnloadDialogCancelled();
   }