Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_unittest.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc |
| index 46acbd1dbae6d48581ac9393358222dd4d686b81..50b619d7f4aeb06dbaacf4ea63c433530f580d1a 100644 |
| --- a/content/browser/renderer_host/render_widget_host_unittest.cc |
| +++ b/content/browser/renderer_host/render_widget_host_unittest.cc |
| @@ -578,11 +578,13 @@ class RenderWidgetHostTest : public testing::Test { |
| scoped_ptr<MockRenderWidgetHostDelegate> delegate_; |
| scoped_ptr<MockRenderWidgetHost> host_; |
| scoped_ptr<TestView> view_; |
| - scoped_ptr<gfx::Screen> screen_; |
| bool handle_key_press_event_; |
| bool handle_mouse_event_; |
| double last_simulated_event_time_seconds_; |
| double simulated_event_time_delta_seconds_; |
| +#if defined(USE_AURA) |
| + scoped_ptr<aura::TestScreen> screen_; |
| +#endif |
| private: |
| SyntheticWebTouchEvent touch_event_; |
| @@ -604,8 +606,12 @@ class RenderWidgetHostWithSourceTest |
| // ----------------------------------------------------------------------------- |
| TEST_F(RenderWidgetHostTest, Resize) { |
| - // The initial bounds is the empty rect, and the screen info hasn't been sent |
| - // yet, so setting it to the same thing shouldn't send the resize message. |
| + // The first resize will send over the initial screen info. |
| + host_->WasResized(); |
| + EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
|
sadrul
2015/04/10 22:58:30
ClearMessages() afterwards before the next block?
mlamouri (slow - plz ping)
2015/04/13 11:39:08
Done.
|
| + |
| + // The initial bounds is the empty rect, so setting it to the same thing |
| + // shouldn't send the resize message. |
| view_->set_bounds(gfx::Rect()); |
| host_->WasResized(); |
| EXPECT_FALSE(host_->resize_ack_pending_); |
| @@ -719,6 +725,27 @@ TEST_F(RenderWidgetHostTest, Resize) { |
| EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| } |
| +// Test resize events with screen info changes. |
| +TEST_F(RenderWidgetHostTest, ResizeScreenInfo) { |
| + // The first resize will send over the initial screen info. |
| + host_->WasResized(); |
| + EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| + |
| +#if defined(USE_AURA) |
| + screen_->SetDisplayRotation(gfx::Display::ROTATE_180); |
| +#endif |
| + host_->InvalidateScreenInfo(); |
| + EXPECT_FALSE(host_->resize_ack_pending_); |
| + EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| + |
| +#if defined(USE_AURA) |
| + screen_->SetDisplayRotation(gfx::Display::ROTATE_90); |
| +#endif |
| + host_->InvalidateScreenInfo(); |
| + EXPECT_FALSE(host_->resize_ack_pending_); |
| + EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
| +} |
| + |
| // Test for crbug.com/25097. If a renderer crashes between a resize and the |
| // corresponding update message, we must be sure to clear the resize ack logic. |
| TEST_F(RenderWidgetHostTest, ResizeThenCrash) { |