Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / test / test_web_contents.cc
index d645b31..d96458b 100644 (file)
@@ -9,8 +9,10 @@
 #include "content/browser/browser_url_handler_impl.h"
 #include "content/browser/frame_host/cross_process_frame_connector.h"
 #include "content/browser/frame_host/navigation_entry_impl.h"
+#include "content/browser/frame_host/navigator.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/browser/site_instance_impl.h"
+#include "content/common/frame_messages.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/notification_registrar.h"
 #include "content/public/browser/notification_source.h"
@@ -68,7 +70,7 @@ void TestWebContents::TestDidNavigateWithReferrer(
     const GURL& url,
     const Referrer& referrer,
     PageTransition transition) {
-  ViewHostMsg_FrameNavigate_Params params;
+  FrameHostMsg_DidCommitProvisionalLoad_Params params;
 
   params.page_id = page_id;
   params.url = url;
@@ -84,7 +86,10 @@ void TestWebContents::TestDidNavigateWithReferrer(
   params.is_post = false;
   params.page_state = PageState::CreateFromURL(url);
 
-  DidNavigate(render_view_host, params);
+  RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(render_view_host);
+  RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(
+      rvh->GetProcess()->GetID(), rvh->main_frame_routing_id());
+  frame_tree_.root()->navigator()->DidNavigate(rfh, params);
 }
 
 WebPreferences TestWebContents::TestGetWebkitPrefs() {
@@ -146,12 +151,11 @@ void TestWebContents::CommitPendingNavigation() {
     page_id = GetMaxPageIDForSiteInstance(rvh->GetSiteInstance()) + 1;
   }
 
-  // Simulate the SwapOut_ACK that happens when we swap out the old
-  // RVH, before the navigation commits. This is needed when
-  // cross-site navigation happens (old_rvh != rvh).
+  rvh->SendNavigate(page_id, entry->GetURL());
+  // Simulate the SwapOut_ACK. This is needed when cross-site navigation happens
+  // (old_rvh != rvh).
   if (old_rvh != rvh)
     static_cast<RenderViewHostImpl*>(old_rvh)->OnSwappedOut(false);
-  rvh->SendNavigate(page_id, entry->GetURL());
 }
 
 void TestWebContents::ProceedWithCrossSiteNavigation() {
@@ -216,9 +220,9 @@ void TestWebContents::TestDidFailLoadWithError(
     bool is_main_frame,
     int error_code,
     const base::string16& error_description) {
-  ViewHostMsg_DidFailLoadWithError msg(
+  FrameHostMsg_DidFailLoadWithError msg(
       0, frame_id, url, is_main_frame, error_code, error_description);
-  OnMessageReceived(GetRenderViewHost(), msg);
+  frame_tree_.root()->current_frame_host()->OnMessageReceived(msg);
 }
 
 void TestWebContents::CreateNewWindow(