Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / test / test_render_view_host.cc
index 38facdb..b243896 100644 (file)
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/page_state.h"
-#include "content/test/test_backing_store.h"
+#include "content/public/common/web_preferences.h"
+#include "content/test/test_render_frame_host.h"
 #include "content/test/test_web_contents.h"
 #include "media/base/video_frame.h"
 #include "ui/gfx/rect.h"
-#include "webkit/common/webpreferences.h"
 
 namespace content {
 
-namespace {
-
-const int64 kFrameId = 13UL;
-
-}  // namespace
-
-
 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params,
                         int page_id,
                         const GURL& url,
-                        PageTransition transition) {
+                        ui::PageTransition transition) {
   params->page_id = page_id;
   params->url = url;
   params->referrer = Referrer();
@@ -64,6 +57,10 @@ RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const {
   return NULL;
 }
 
+gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const {
+  return gfx::Vector2dF();
+}
+
 gfx::NativeView TestRenderWidgetHostView::GetNativeView() const {
   return NULL;
 }
@@ -76,6 +73,10 @@ gfx::NativeViewAccessible TestRenderWidgetHostView::GetNativeViewAccessible() {
   return NULL;
 }
 
+ui::TextInputClient* TestRenderWidgetHostView::GetTextInputClient() {
+  return &text_input_client_;
+}
+
 bool TestRenderWidgetHostView::HasFocus() const {
   return true;
 }
@@ -107,16 +108,11 @@ gfx::Rect TestRenderWidgetHostView::GetViewBounds() const {
   return gfx::Rect();
 }
 
-BackingStore* TestRenderWidgetHostView::AllocBackingStore(
-    const gfx::Size& size) {
-  return new TestBackingStore(rwh_, size);
-}
-
 void TestRenderWidgetHostView::CopyFromCompositingSurface(
     const gfx::Rect& src_subrect,
     const gfx::Size& dst_size,
-    const base::Callback<void(bool, const SkBitmap&)>& callback,
-    const SkBitmap::Config config) {
+    CopyFromCompositingSurfaceCallback& callback,
+    const SkColorType color_type) {
   callback.Run(false, SkBitmap());
 }
 
@@ -131,9 +127,6 @@ bool TestRenderWidgetHostView::CanCopyToVideoFrame() const {
   return false;
 }
 
-void TestRenderWidgetHostView::OnAcceleratedCompositingStateChange() {
-}
-
 void TestRenderWidgetHostView::AcceleratedSurfaceInitialized(int host_id,
                                                              int route_id) {
 }
@@ -187,16 +180,6 @@ gfx::Rect TestRenderWidgetHostView::GetBoundsInRootWindow() {
   return gfx::Rect();
 }
 
-#if defined(TOOLKIT_GTK)
-GdkEventButton* TestRenderWidgetHostView::GetLastMouseDown() {
-  return NULL;
-}
-
-gfx::NativeView TestRenderWidgetHostView::BuildInputMethodsGtkMenu() {
-  return NULL;
-}
-#endif  // defined(TOOLKIT_GTK)
-
 void TestRenderWidgetHostView::OnSwapCompositorFrame(
     uint32 output_surface_id,
     scoped_ptr<cc::CompositorFrame> frame) {
@@ -251,8 +234,6 @@ TestRenderViewHost::TestRenderViewHost(
   // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is
   // called.
   new TestRenderWidgetHostView(this);
-
-  main_frame_id_ = kFrameId;
 }
 
 TestRenderViewHost::~TestRenderViewHost() {
@@ -263,7 +244,9 @@ TestRenderViewHost::~TestRenderViewHost() {
 bool TestRenderViewHost::CreateRenderView(
     const base::string16& frame_name,
     int opener_route_id,
-    int32 max_page_id) {
+    int proxy_route_id,
+    int32 max_page_id,
+    bool window_was_created_with_opener) {
   DCHECK(!render_view_created_);
   render_view_created_ = true;
   opener_route_id_ = opener_route_id;
@@ -274,6 +257,10 @@ bool TestRenderViewHost::IsRenderViewLive() const {
   return render_view_created_;
 }
 
+bool TestRenderViewHost::IsFullscreen() const {
+  return RenderViewHostImpl::IsFullscreen();
+}
+
 void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) {
   main_render_frame_host_->SendNavigate(page_id, url);
 }
@@ -285,7 +272,7 @@ void TestRenderViewHost::SendFailedNavigate(int page_id, const GURL& url) {
 void TestRenderViewHost::SendNavigateWithTransition(
     int page_id,
     const GURL& url,
-    PageTransition transition) {
+    ui::PageTransition transition) {
   main_render_frame_host_->SendNavigateWithTransition(page_id, url, transition);
 }
 
@@ -312,7 +299,7 @@ void TestRenderViewHost::SendNavigateWithParams(
 void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode(
     int page_id,
     const GURL& url,
-    PageTransition transition,
+    ui::PageTransition transition,
     int response_code) {
   main_render_frame_host_->SendNavigateWithTransitionAndResponseCode(
       page_id, url, transition, response_code);
@@ -321,19 +308,20 @@ void TestRenderViewHost::SendNavigateWithTransitionAndResponseCode(
 void TestRenderViewHost::SendNavigateWithParameters(
     int page_id,
     const GURL& url,
-    PageTransition transition,
+    ui::PageTransition transition,
     const GURL& original_request_url,
     int response_code,
     const base::FilePath* file_path_for_history_item) {
 
   main_render_frame_host_->SendNavigateWithParameters(
       page_id, url, transition, original_request_url, response_code,
-      file_path_for_history_item);
+      file_path_for_history_item, std::vector<GURL>());
 }
 
-void TestRenderViewHost::SendShouldCloseACK(bool proceed) {
+void TestRenderViewHost::SendBeforeUnloadACK(bool proceed) {
+  // TODO(creis): Move this whole method to TestRenderFrameHost.
   base::TimeTicks now = base::TimeTicks::Now();
-  OnShouldCloseACK(proceed, now, now);
+  main_render_frame_host_->OnBeforeUnloadACK(proceed, now, now);
 }
 
 void TestRenderViewHost::SetContentsMimeType(const std::string& mime_type) {
@@ -350,7 +338,7 @@ void TestRenderViewHost::SimulateWasHidden() {
 }
 
 void TestRenderViewHost::SimulateWasShown() {
-  WasShown();
+  WasShown(ui::LatencyInfo());
 }
 
 void TestRenderViewHost::TestOnStartDragging(
@@ -362,9 +350,9 @@ void TestRenderViewHost::TestOnStartDragging(
 }
 
 void TestRenderViewHost::TestOnUpdateStateWithFile(
-    int process_id,
+    int page_id,
     const base::FilePath& file_path) {
-  OnUpdateState(process_id,
+  OnUpdateState(page_id,
                 PageState::CreateForTesting(GURL("http://www.google.com"),
                                             false,
                                             "data",
@@ -391,11 +379,13 @@ RenderViewHostImplTestHarness::~RenderViewHostImplTestHarness() {
 }
 
 TestRenderViewHost* RenderViewHostImplTestHarness::test_rvh() {
-  return static_cast<TestRenderViewHost*>(rvh());
+  return contents()->GetRenderViewHost();
 }
 
 TestRenderViewHost* RenderViewHostImplTestHarness::pending_test_rvh() {
-  return static_cast<TestRenderViewHost*>(pending_rvh());
+  return contents()->GetPendingMainFrame() ?
+      contents()->GetPendingMainFrame()->GetRenderViewHost() :
+      NULL;
 }
 
 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() {
@@ -403,7 +393,7 @@ TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() {
 }
 
 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() {
-  return static_cast<TestRenderFrameHost*>(main_rfh());
+  return contents()->GetMainFrame();
 }
 
 TestWebContents* RenderViewHostImplTestHarness::contents() {