Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / public / test / render_widget_test.cc
index 211a24f..b86753b 100644 (file)
@@ -13,6 +13,7 @@
 #include "content/renderer/render_view_impl.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkBitmap.h"
+#include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
 #include "third_party/WebKit/public/platform/WebSize.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "ui/gfx/codec/jpeg_codec.h"
@@ -59,21 +60,11 @@ void RenderWidgetTest::TestOnResize() {
   resize_params.physical_backing_size = size;
   widget->OnResize(resize_params);
   EXPECT_TRUE(widget->next_paint_is_resize_ack());
-  widget->DoDeferredUpdate();
-  ProcessPendingMessages();
 
-  const ViewHostMsg_UpdateRect* msg =
-      static_cast<const ViewHostMsg_UpdateRect*>(
-          render_thread_->sink().GetUniqueMessageMatching(
-              ViewHostMsg_UpdateRect::ID));
-  ASSERT_TRUE(msg);
-  ViewHostMsg_UpdateRect::Schema::Param update_rect_params;
-  EXPECT_TRUE(ViewHostMsg_UpdateRect::Read(msg, &update_rect_params));
-  EXPECT_TRUE(ViewHostMsg_UpdateRect_Flags::is_resize_ack(
-      update_rect_params.a.flags));
-  EXPECT_EQ(size,
-      update_rect_params.a.view_size);
-  render_thread_->sink().ClearMessages();
+  // Clear the flag.
+  // TODO(danakj): How real is this test any more? This flag is only existing
+  // for DCHECKs now.
+  widget->didCompleteSwapBuffers();
 
   // Setting the same size again should not send the ack.
   widget->OnResize(resize_params);
@@ -84,6 +75,16 @@ void RenderWidgetTest::TestOnResize() {
   resize_params.physical_backing_size = gfx::Size();
   widget->OnResize(resize_params);
   EXPECT_FALSE(widget->next_paint_is_resize_ack());
+
+  // Changing the screen info should not send the ack.
+  resize_params.screen_info.orientationAngle = 90;
+  widget->OnResize(resize_params);
+  EXPECT_FALSE(widget->next_paint_is_resize_ack());
+
+  resize_params.screen_info.orientationType =
+      blink::WebScreenOrientationPortraitPrimary;
+  widget->OnResize(resize_params);
+  EXPECT_FALSE(widget->next_paint_is_resize_ack());
 }
 
 }  // namespace content