Remove redundant WebLocalFrame* parameter from DidFailProvisionalLoad

Remove redundant WebLocalFrame* parameter from DidFailProvisionalLoad in
WebFrameClient. Also updated WebFrameTest tests where appropriate, and
added a new ASSERT as pre-work for removing it from other methods.

BUG=361765

Review-Url: https://codereview.chromium.org/2827193002
Cr-Commit-Position: refs/heads/master@{#465907}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index a05efc3..3e6848ba 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -3576,35 +3576,33 @@
 }
 
 void RenderFrameImpl::DidFailProvisionalLoad(
-    blink::WebLocalFrame* frame,
     const blink::WebURLError& error,
     blink::WebHistoryCommitType commit_type) {
   TRACE_EVENT1("navigation,benchmark,rail",
                "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_);
-  DCHECK_EQ(frame_, frame);
   // Note: It is important this notification occur before DidStopLoading so the
   //       SSL manager can react to the provisional load failure before being
   //       notified the load stopped.
   //
   for (auto& observer : render_view_->observers())
-    observer.DidFailProvisionalLoad(frame, error);
+    observer.DidFailProvisionalLoad(frame_, error);
   for (auto& observer : observers_)
     observer.DidFailProvisionalLoad(error);
 
-  WebDataSource* ds = frame->ProvisionalDataSource();
+  WebDataSource* ds = frame_->ProvisionalDataSource();
   if (!ds)
     return;
 
   const WebURLRequest& failed_request = ds->GetRequest();
 
   // Notify the browser that we failed a provisional load with an error.
-  SendFailedProvisionalLoad(failed_request, error, frame);
+  SendFailedProvisionalLoad(failed_request, error, frame_);
 
   if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachable_url))
     return;
 
   // Make sure we never show errors in view source mode.
-  frame->EnableViewSourceMode(false);
+  frame_->EnableViewSourceMode(false);
 
   DocumentState* document_state = DocumentState::FromDataSource(ds);
   NavigationStateImpl* navigation_state =
@@ -5309,9 +5307,8 @@
   // notification.
   bool had_provisional_data_source = frame_->ProvisionalDataSource();
   if (request_params.nav_entry_id == 0) {
-    DidFailProvisionalLoad(
-        frame_, error,
-        replace ? blink::kWebHistoryInertCommit : blink::kWebStandardCommit);
+    DidFailProvisionalLoad(error, replace ? blink::kWebHistoryInertCommit
+                                          : blink::kWebStandardCommit);
   }
 
   // If we didn't call didFailProvisionalLoad or there wasn't a
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 4353e1a..bcb48d1 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -562,8 +562,7 @@
   void DidStartProvisionalLoad(blink::WebDataSource* data_source,
                                blink::WebURLRequest& request) override;
   void DidReceiveServerRedirectForProvisionalLoad() override;
-  void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
-                              const blink::WebURLError& error,
+  void DidFailProvisionalLoad(const blink::WebURLError& error,
                               blink::WebHistoryCommitType commit_type) override;
   void DidCommitProvisionalLoad(
       blink::WebLocalFrame* frame,
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 6f4c28cc..786f109 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -1357,7 +1357,7 @@
 
   // An error occurred.
   view()->GetMainRenderFrame()->DidFailProvisionalLoad(
-      web_frame, error, blink::kWebStandardCommit);
+      error, blink::kWebStandardCommit);
   // Frame should exit view-source mode.
   EXPECT_FALSE(web_frame->IsViewSourceModeEnabled());
 }
@@ -1380,7 +1380,7 @@
 
   // A cancellation occurred.
   view()->GetMainRenderFrame()->DidFailProvisionalLoad(
-      web_frame, error, blink::kWebStandardCommit);
+      error, blink::kWebStandardCommit);
   // Frame should stay in view-source mode.
   EXPECT_TRUE(web_frame->IsViewSourceModeEnabled());
 }
@@ -1815,7 +1815,6 @@
   error.domain = WebString::FromUTF8(net::kErrorDomain);
   error.reason = net::ERR_FILE_NOT_FOUND;
   error.unreachable_url = GURL("http://example.com/suppress");
-  WebLocalFrame* web_frame = GetMainFrame();
 
   // Start a load that will reach provisional state synchronously,
   // but won't complete synchronously.
@@ -1827,8 +1826,7 @@
                        RequestNavigationParams());
 
   // An error occurred.
-  main_frame->DidFailProvisionalLoad(web_frame, error,
-                                     blink::kWebStandardCommit);
+  main_frame->DidFailProvisionalLoad(error, blink::kWebStandardCommit);
   const int kMaxOutputCharacters = 22;
   EXPECT_EQ("", WebFrameContentDumper::DumpWebViewAsText(view()->GetWebView(),
                                                          kMaxOutputCharacters)
@@ -1847,7 +1845,6 @@
   error.domain = WebString::FromUTF8(net::kErrorDomain);
   error.reason = net::ERR_FILE_NOT_FOUND;
   error.unreachable_url = GURL("http://example.com/dont-suppress");
-  WebLocalFrame* web_frame = GetMainFrame();
 
   // Start a load that will reach provisional state synchronously,
   // but won't complete synchronously.
@@ -1859,8 +1856,7 @@
                        RequestNavigationParams());
 
   // An error occurred.
-  main_frame->DidFailProvisionalLoad(web_frame, error,
-                                     blink::kWebStandardCommit);
+  main_frame->DidFailProvisionalLoad(error, blink::kWebStandardCommit);
 
   // The error page itself is loaded asynchronously.
   FrameLoadWaiter(main_frame).Wait();
diff --git a/content/shell/test_runner/web_frame_test_client.cc b/content/shell/test_runner/web_frame_test_client.cc
index 5effc91..9ccbecf5 100644
--- a/content/shell/test_runner/web_frame_test_client.cc
+++ b/content/shell/test_runner/web_frame_test_client.cc
@@ -446,11 +446,10 @@
 }
 
 void WebFrameTestClient::DidFailProvisionalLoad(
-    blink::WebLocalFrame* frame,
     const blink::WebURLError& error,
     blink::WebHistoryCommitType commit_type) {
   if (test_runner()->shouldDumpFrameLoadCallbacks()) {
-    PrintFrameDescription(delegate_, frame);
+    PrintFrameDescription(delegate_, web_frame_test_proxy_base_->web_frame());
     delegate_->PrintMessage(" - didFailProvisionalLoadWithError\n");
   }
 }
diff --git a/content/shell/test_runner/web_frame_test_client.h b/content/shell/test_runner/web_frame_test_client.h
index 7aeeebf..0ca3d1b 100644
--- a/content/shell/test_runner/web_frame_test_client.h
+++ b/content/shell/test_runner/web_frame_test_client.h
@@ -64,8 +64,7 @@
   void DidStartProvisionalLoad(blink::WebDataSource* data_source,
                                blink::WebURLRequest& request) override;
   void DidReceiveServerRedirectForProvisionalLoad() override;
-  void DidFailProvisionalLoad(blink::WebLocalFrame* frame,
-                              const blink::WebURLError& error,
+  void DidFailProvisionalLoad(const blink::WebURLError& error,
                               blink::WebHistoryCommitType commit_type) override;
   void DidCommitProvisionalLoad(
       blink::WebLocalFrame* frame,
diff --git a/content/shell/test_runner/web_frame_test_proxy.h b/content/shell/test_runner/web_frame_test_proxy.h
index ff9bef4..d505374 100644
--- a/content/shell/test_runner/web_frame_test_proxy.h
+++ b/content/shell/test_runner/web_frame_test_proxy.h
@@ -108,15 +108,14 @@
   }
 
   void DidFailProvisionalLoad(
-      blink::WebLocalFrame* frame,
       const blink::WebURLError& error,
       blink::WebHistoryCommitType commit_type) override {
-    test_client()->DidFailProvisionalLoad(frame, error, commit_type);
+    test_client()->DidFailProvisionalLoad(error, commit_type);
     // If the test finished, don't notify the embedder of the failed load,
     // as we already destroyed the document loader.
-    if (!frame->ProvisionalDataSource())
+    if (!web_frame()->ProvisionalDataSource())
       return;
-    Base::DidFailProvisionalLoad(frame, error, commit_type);
+    Base::DidFailProvisionalLoad(error, commit_type);
   }
 
   void DidCommitProvisionalLoad(