OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/resize_params.h" | 5 #include "content/common/resize_params.h" |
6 #include "content/public/test/render_view_test.h" | 6 #include "content/public/test/render_view_test.h" |
7 #include "content/renderer/render_view_impl.h" | 7 #include "content/renderer/render_view_impl.h" |
8 #include "content/renderer/render_widget.h" | 8 #include "content/renderer/render_widget.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 bool next_paint_is_resize_ack() { | 26 bool next_paint_is_resize_ack() { |
27 return widget()->next_paint_is_resize_ack(); | 27 return widget()->next_paint_is_resize_ack(); |
28 } | 28 } |
29 }; | 29 }; |
30 | 30 |
31 TEST_F(RenderWidgetTest, OnResize) { | 31 TEST_F(RenderWidgetTest, OnResize) { |
32 // The initial bounds is empty, so setting it to the same thing should do | 32 // The initial bounds is empty, so setting it to the same thing should do |
33 // nothing. | 33 // nothing. |
34 ResizeParams resize_params; | 34 ResizeParams resize_params; |
35 resize_params.screen_info = blink::WebScreenInfo(); | 35 resize_params.screen_info = ScreenInfo(); |
36 resize_params.new_size = gfx::Size(); | 36 resize_params.new_size = gfx::Size(); |
37 resize_params.physical_backing_size = gfx::Size(); | 37 resize_params.physical_backing_size = gfx::Size(); |
38 resize_params.top_controls_height = 0.f; | 38 resize_params.top_controls_height = 0.f; |
39 resize_params.top_controls_shrink_blink_size = false; | 39 resize_params.top_controls_shrink_blink_size = false; |
40 resize_params.resizer_rect = gfx::Rect(); | 40 resize_params.resizer_rect = gfx::Rect(); |
41 resize_params.is_fullscreen_granted = false; | 41 resize_params.is_fullscreen_granted = false; |
42 resize_params.needs_resize_ack = false; | 42 resize_params.needs_resize_ack = false; |
43 OnResize(resize_params); | 43 OnResize(resize_params); |
44 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); | 44 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); |
45 | 45 |
(...skipping 19 matching lines...) Expand all Loading... |
65 OnResize(resize_params); | 65 OnResize(resize_params); |
66 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); | 66 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); |
67 | 67 |
68 // Resetting the rect to empty should not send the ack. | 68 // Resetting the rect to empty should not send the ack. |
69 resize_params.new_size = gfx::Size(); | 69 resize_params.new_size = gfx::Size(); |
70 resize_params.physical_backing_size = gfx::Size(); | 70 resize_params.physical_backing_size = gfx::Size(); |
71 OnResize(resize_params); | 71 OnResize(resize_params); |
72 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); | 72 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); |
73 | 73 |
74 // Changing the screen info should not send the ack. | 74 // Changing the screen info should not send the ack. |
75 resize_params.screen_info.orientationAngle = 90; | 75 resize_params.screen_info.orientation_angle = 90; |
76 OnResize(resize_params); | 76 OnResize(resize_params); |
77 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); | 77 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); |
78 | 78 |
79 resize_params.screen_info.orientationType = | 79 resize_params.screen_info.orientation_type = |
80 blink::WebScreenOrientationPortraitPrimary; | 80 SCREEN_ORIENTATION_VALUES_PORTRAIT_PRIMARY; |
81 OnResize(resize_params); | 81 OnResize(resize_params); |
82 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); | 82 EXPECT_EQ(resize_params.needs_resize_ack, next_paint_is_resize_ack()); |
83 } | 83 } |
84 | 84 |
85 class RenderWidgetInitialSizeTest : public RenderWidgetTest { | 85 class RenderWidgetInitialSizeTest : public RenderWidgetTest { |
86 public: | 86 public: |
87 RenderWidgetInitialSizeTest() | 87 RenderWidgetInitialSizeTest() |
88 : RenderWidgetTest(), initial_size_(200, 100) {} | 88 : RenderWidgetTest(), initial_size_(200, 100) {} |
89 | 89 |
90 protected: | 90 protected: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 LoadHTML("<div>NOT EDITABLE</div>"); | 133 LoadHTML("<div>NOT EDITABLE</div>"); |
134 gfx::Range range; | 134 gfx::Range range; |
135 GetCompositionRange(&range); | 135 GetCompositionRange(&range); |
136 // If this test ever starts failing, one likely outcome is that WebRange | 136 // If this test ever starts failing, one likely outcome is that WebRange |
137 // and gfx::Range::InvalidRange are no longer expressed in the same | 137 // and gfx::Range::InvalidRange are no longer expressed in the same |
138 // values of start/end. | 138 // values of start/end. |
139 EXPECT_FALSE(range.IsValid()); | 139 EXPECT_FALSE(range.IsValid()); |
140 } | 140 } |
141 | 141 |
142 } // namespace content | 142 } // namespace content |
OLD | NEW |