| 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/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 void AckLastSentInputEventIfNecessary(InputEventAckState ack_result) { | 651 void AckLastSentInputEventIfNecessary(InputEventAckState ack_result) { |
| 652 if (!sink_->message_count()) | 652 if (!sink_->message_count()) |
| 653 return; | 653 return; |
| 654 | 654 |
| 655 InputMsg_HandleInputEvent::Param params; | 655 InputMsg_HandleInputEvent::Param params; |
| 656 if (!InputMsg_HandleInputEvent::Read( | 656 if (!InputMsg_HandleInputEvent::Read( |
| 657 sink_->GetMessageAt(sink_->message_count() - 1), ¶ms)) { | 657 sink_->GetMessageAt(sink_->message_count() - 1), ¶ms)) { |
| 658 return; | 658 return; |
| 659 } | 659 } |
| 660 | 660 |
| 661 if (WebInputEventTraits::IgnoresAckDisposition(*params.a)) | 661 if (WebInputEventTraits::IgnoresAckDisposition(*get<0>(params))) |
| 662 return; | 662 return; |
| 663 | 663 |
| 664 SendInputEventACK(params.a->type, ack_result); | 664 SendInputEventACK(get<0>(params)->type, ack_result); |
| 665 } | 665 } |
| 666 | 666 |
| 667 SyntheticWebTouchEvent touch_event_; | 667 SyntheticWebTouchEvent touch_event_; |
| 668 | 668 |
| 669 scoped_ptr<TestOverscrollDelegate> overscroll_delegate_; | 669 scoped_ptr<TestOverscrollDelegate> overscroll_delegate_; |
| 670 | 670 |
| 671 private: | 671 private: |
| 672 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraOverscrollTest); | 672 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraOverscrollTest); |
| 673 }; | 673 }; |
| 674 | 674 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 view_->SetCompositionText(composition_text); | 896 view_->SetCompositionText(composition_text); |
| 897 EXPECT_TRUE(view_->has_composition_text_); | 897 EXPECT_TRUE(view_->has_composition_text_); |
| 898 { | 898 { |
| 899 const IPC::Message* msg = | 899 const IPC::Message* msg = |
| 900 sink_->GetFirstMessageMatching(InputMsg_ImeSetComposition::ID); | 900 sink_->GetFirstMessageMatching(InputMsg_ImeSetComposition::ID); |
| 901 ASSERT_TRUE(msg != NULL); | 901 ASSERT_TRUE(msg != NULL); |
| 902 | 902 |
| 903 InputMsg_ImeSetComposition::Param params; | 903 InputMsg_ImeSetComposition::Param params; |
| 904 InputMsg_ImeSetComposition::Read(msg, ¶ms); | 904 InputMsg_ImeSetComposition::Read(msg, ¶ms); |
| 905 // composition text | 905 // composition text |
| 906 EXPECT_EQ(composition_text.text, params.a); | 906 EXPECT_EQ(composition_text.text, get<0>(params)); |
| 907 // underlines | 907 // underlines |
| 908 ASSERT_EQ(underlines.size(), params.b.size()); | 908 ASSERT_EQ(underlines.size(), get<1>(params).size()); |
| 909 for (size_t i = 0; i < underlines.size(); ++i) { | 909 for (size_t i = 0; i < underlines.size(); ++i) { |
| 910 EXPECT_EQ(underlines[i].start_offset, params.b[i].startOffset); | 910 EXPECT_EQ(underlines[i].start_offset, get<1>(params)[i].startOffset); |
| 911 EXPECT_EQ(underlines[i].end_offset, params.b[i].endOffset); | 911 EXPECT_EQ(underlines[i].end_offset, get<1>(params)[i].endOffset); |
| 912 EXPECT_EQ(underlines[i].color, params.b[i].color); | 912 EXPECT_EQ(underlines[i].color, get<1>(params)[i].color); |
| 913 EXPECT_EQ(underlines[i].thick, params.b[i].thick); | 913 EXPECT_EQ(underlines[i].thick, get<1>(params)[i].thick); |
| 914 EXPECT_EQ(underlines[i].background_color, params.b[i].backgroundColor); | 914 EXPECT_EQ(underlines[i].background_color, |
| 915 get<1>(params)[i].backgroundColor); |
| 915 } | 916 } |
| 916 // highlighted range | 917 // highlighted range |
| 917 EXPECT_EQ(4, params.c) << "Should be the same to the caret pos"; | 918 EXPECT_EQ(4, get<2>(params)) << "Should be the same to the caret pos"; |
| 918 EXPECT_EQ(4, params.d) << "Should be the same to the caret pos"; | 919 EXPECT_EQ(4, get<3>(params)) << "Should be the same to the caret pos"; |
| 919 } | 920 } |
| 920 | 921 |
| 921 view_->ImeCancelComposition(); | 922 view_->ImeCancelComposition(); |
| 922 EXPECT_FALSE(view_->has_composition_text_); | 923 EXPECT_FALSE(view_->has_composition_text_); |
| 923 } | 924 } |
| 924 | 925 |
| 925 // Checks that sequence of IME-composition-event and mouse-event when mouse | 926 // Checks that sequence of IME-composition-event and mouse-event when mouse |
| 926 // clicking to cancel the composition. | 927 // clicking to cancel the composition. |
| 927 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { | 928 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { |
| 928 view_->InitAsChild(NULL); | 929 view_->InitAsChild(NULL); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 sink_->ClearMessages(); | 1133 sink_->ClearMessages(); |
| 1133 view_->SetSize(gfx::Size(100, 100)); | 1134 view_->SetSize(gfx::Size(100, 100)); |
| 1134 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); | 1135 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); |
| 1135 EXPECT_EQ(1u, sink_->message_count()); | 1136 EXPECT_EQ(1u, sink_->message_count()); |
| 1136 EXPECT_EQ(ViewMsg_Resize::ID, sink_->GetMessageAt(0)->type()); | 1137 EXPECT_EQ(ViewMsg_Resize::ID, sink_->GetMessageAt(0)->type()); |
| 1137 { | 1138 { |
| 1138 const IPC::Message* msg = sink_->GetMessageAt(0); | 1139 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1139 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1140 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1140 ViewMsg_Resize::Param params; | 1141 ViewMsg_Resize::Param params; |
| 1141 ViewMsg_Resize::Read(msg, ¶ms); | 1142 ViewMsg_Resize::Read(msg, ¶ms); |
| 1142 EXPECT_EQ("100x100", params.a.new_size.ToString()); // dip size | 1143 EXPECT_EQ("100x100", get<0>(params).new_size.ToString()); // dip size |
| 1143 EXPECT_EQ("100x100", | 1144 EXPECT_EQ("100x100", |
| 1144 params.a.physical_backing_size.ToString()); // backing size | 1145 get<0>(params).physical_backing_size.ToString()); // backing size |
| 1145 } | 1146 } |
| 1146 | 1147 |
| 1147 widget_host_->ResetSizeAndRepaintPendingFlags(); | 1148 widget_host_->ResetSizeAndRepaintPendingFlags(); |
| 1148 sink_->ClearMessages(); | 1149 sink_->ClearMessages(); |
| 1149 | 1150 |
| 1150 aura_test_helper_->test_screen()->SetDeviceScaleFactor(2.0f); | 1151 aura_test_helper_->test_screen()->SetDeviceScaleFactor(2.0f); |
| 1151 EXPECT_EQ("200x200", view_->GetPhysicalBackingSize().ToString()); | 1152 EXPECT_EQ("200x200", view_->GetPhysicalBackingSize().ToString()); |
| 1152 // Extra ScreenInfoChanged message for |parent_view_|. | 1153 // Extra ScreenInfoChanged message for |parent_view_|. |
| 1153 EXPECT_EQ(1u, sink_->message_count()); | 1154 EXPECT_EQ(1u, sink_->message_count()); |
| 1154 { | 1155 { |
| 1155 const IPC::Message* msg = sink_->GetMessageAt(0); | 1156 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1156 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1157 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1157 ViewMsg_Resize::Param params; | 1158 ViewMsg_Resize::Param params; |
| 1158 ViewMsg_Resize::Read(msg, ¶ms); | 1159 ViewMsg_Resize::Read(msg, ¶ms); |
| 1159 EXPECT_EQ(2.0f, params.a.screen_info.deviceScaleFactor); | 1160 EXPECT_EQ(2.0f, get<0>(params).screen_info.deviceScaleFactor); |
| 1160 EXPECT_EQ("100x100", params.a.new_size.ToString()); // dip size | 1161 EXPECT_EQ("100x100", get<0>(params).new_size.ToString()); // dip size |
| 1161 EXPECT_EQ("200x200", | 1162 EXPECT_EQ("200x200", |
| 1162 params.a.physical_backing_size.ToString()); // backing size | 1163 get<0>(params).physical_backing_size.ToString()); // backing size |
| 1163 } | 1164 } |
| 1164 | 1165 |
| 1165 widget_host_->ResetSizeAndRepaintPendingFlags(); | 1166 widget_host_->ResetSizeAndRepaintPendingFlags(); |
| 1166 sink_->ClearMessages(); | 1167 sink_->ClearMessages(); |
| 1167 | 1168 |
| 1168 aura_test_helper_->test_screen()->SetDeviceScaleFactor(1.0f); | 1169 aura_test_helper_->test_screen()->SetDeviceScaleFactor(1.0f); |
| 1169 // Extra ScreenInfoChanged message for |parent_view_|. | 1170 // Extra ScreenInfoChanged message for |parent_view_|. |
| 1170 EXPECT_EQ(1u, sink_->message_count()); | 1171 EXPECT_EQ(1u, sink_->message_count()); |
| 1171 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); | 1172 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); |
| 1172 { | 1173 { |
| 1173 const IPC::Message* msg = sink_->GetMessageAt(0); | 1174 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1174 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1175 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1175 ViewMsg_Resize::Param params; | 1176 ViewMsg_Resize::Param params; |
| 1176 ViewMsg_Resize::Read(msg, ¶ms); | 1177 ViewMsg_Resize::Read(msg, ¶ms); |
| 1177 EXPECT_EQ(1.0f, params.a.screen_info.deviceScaleFactor); | 1178 EXPECT_EQ(1.0f, get<0>(params).screen_info.deviceScaleFactor); |
| 1178 EXPECT_EQ("100x100", params.a.new_size.ToString()); // dip size | 1179 EXPECT_EQ("100x100", get<0>(params).new_size.ToString()); // dip size |
| 1179 EXPECT_EQ("100x100", | 1180 EXPECT_EQ("100x100", |
| 1180 params.a.physical_backing_size.ToString()); // backing size | 1181 get<0>(params).physical_backing_size.ToString()); // backing size |
| 1181 } | 1182 } |
| 1182 } | 1183 } |
| 1183 | 1184 |
| 1184 // Checks that InputMsg_CursorVisibilityChange IPC messages are dispatched | 1185 // Checks that InputMsg_CursorVisibilityChange IPC messages are dispatched |
| 1185 // to the renderer at the correct times. | 1186 // to the renderer at the correct times. |
| 1186 TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) { | 1187 TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) { |
| 1187 view_->InitAsChild(NULL); | 1188 view_->InitAsChild(NULL); |
| 1188 aura::client::ParentWindowWithContext( | 1189 aura::client::ParentWindowWithContext( |
| 1189 view_->GetNativeView(), | 1190 view_->GetNativeView(), |
| 1190 parent_view_->GetNativeView()->GetRootWindow(), | 1191 parent_view_->GetNativeView()->GetRootWindow(), |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 | 1336 |
| 1336 // Call WasResized to flush the old screen info. | 1337 // Call WasResized to flush the old screen info. |
| 1337 view_->GetRenderWidgetHost()->WasResized(); | 1338 view_->GetRenderWidgetHost()->WasResized(); |
| 1338 { | 1339 { |
| 1339 // 0 is CreatingNew message. | 1340 // 0 is CreatingNew message. |
| 1340 const IPC::Message* msg = sink_->GetMessageAt(0); | 1341 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1341 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1342 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1342 ViewMsg_Resize::Param params; | 1343 ViewMsg_Resize::Param params; |
| 1343 ViewMsg_Resize::Read(msg, ¶ms); | 1344 ViewMsg_Resize::Read(msg, ¶ms); |
| 1344 EXPECT_EQ("0,0 800x600", | 1345 EXPECT_EQ("0,0 800x600", |
| 1345 gfx::Rect(params.a.screen_info.availableRect).ToString()); | 1346 gfx::Rect(get<0>(params).screen_info.availableRect).ToString()); |
| 1346 EXPECT_EQ("800x600", params.a.new_size.ToString()); | 1347 EXPECT_EQ("800x600", get<0>(params).new_size.ToString()); |
| 1347 // Resizes are blocked until we swapped a frame of the correct size, and | 1348 // Resizes are blocked until we swapped a frame of the correct size, and |
| 1348 // we've committed it. | 1349 // we've committed it. |
| 1349 view_->OnSwapCompositorFrame( | 1350 view_->OnSwapCompositorFrame( |
| 1350 0, | 1351 0, |
| 1351 MakeDelegatedFrame( | 1352 MakeDelegatedFrame( |
| 1352 1.f, params.a.new_size, gfx::Rect(params.a.new_size))); | 1353 1.f, get<0>(params).new_size, gfx::Rect(get<0>(params).new_size))); |
| 1353 ui::DrawWaiterForTest::WaitForCommit( | 1354 ui::DrawWaiterForTest::WaitForCommit( |
| 1354 root_window->GetHost()->compositor()); | 1355 root_window->GetHost()->compositor()); |
| 1355 } | 1356 } |
| 1356 | 1357 |
| 1357 widget_host_->ResetSizeAndRepaintPendingFlags(); | 1358 widget_host_->ResetSizeAndRepaintPendingFlags(); |
| 1358 sink_->ClearMessages(); | 1359 sink_->ClearMessages(); |
| 1359 | 1360 |
| 1360 // Make sure the corrent screen size is set along in the resize | 1361 // Make sure the corrent screen size is set along in the resize |
| 1361 // request when the screen size has changed. | 1362 // request when the screen size has changed. |
| 1362 aura_test_helper_->test_screen()->SetUIScale(0.5); | 1363 aura_test_helper_->test_screen()->SetUIScale(0.5); |
| 1363 EXPECT_EQ(1u, sink_->message_count()); | 1364 EXPECT_EQ(1u, sink_->message_count()); |
| 1364 { | 1365 { |
| 1365 const IPC::Message* msg = sink_->GetMessageAt(0); | 1366 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1366 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1367 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1367 ViewMsg_Resize::Param params; | 1368 ViewMsg_Resize::Param params; |
| 1368 ViewMsg_Resize::Read(msg, ¶ms); | 1369 ViewMsg_Resize::Read(msg, ¶ms); |
| 1369 EXPECT_EQ("0,0 1600x1200", | 1370 EXPECT_EQ("0,0 1600x1200", |
| 1370 gfx::Rect(params.a.screen_info.availableRect).ToString()); | 1371 gfx::Rect(get<0>(params).screen_info.availableRect).ToString()); |
| 1371 EXPECT_EQ("1600x1200", params.a.new_size.ToString()); | 1372 EXPECT_EQ("1600x1200", get<0>(params).new_size.ToString()); |
| 1372 view_->OnSwapCompositorFrame( | 1373 view_->OnSwapCompositorFrame( |
| 1373 0, | 1374 0, |
| 1374 MakeDelegatedFrame( | 1375 MakeDelegatedFrame( |
| 1375 1.f, params.a.new_size, gfx::Rect(params.a.new_size))); | 1376 1.f, get<0>(params).new_size, gfx::Rect(get<0>(params).new_size))); |
| 1376 ui::DrawWaiterForTest::WaitForCommit( | 1377 ui::DrawWaiterForTest::WaitForCommit( |
| 1377 root_window->GetHost()->compositor()); | 1378 root_window->GetHost()->compositor()); |
| 1378 } | 1379 } |
| 1379 } | 1380 } |
| 1380 | 1381 |
| 1381 // Swapping a frame should notify the window. | 1382 // Swapping a frame should notify the window. |
| 1382 TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { | 1383 TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { |
| 1383 gfx::Size view_size(100, 100); | 1384 gfx::Size view_size(100, 100); |
| 1384 gfx::Rect view_rect(view_size); | 1385 gfx::Rect view_rect(view_size); |
| 1385 | 1386 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 | 1465 |
| 1465 // Resize renderer, should produce a Resize message | 1466 // Resize renderer, should produce a Resize message |
| 1466 view_->SetSize(size2); | 1467 view_->SetSize(size2); |
| 1467 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); | 1468 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); |
| 1468 EXPECT_EQ(1u, sink_->message_count()); | 1469 EXPECT_EQ(1u, sink_->message_count()); |
| 1469 { | 1470 { |
| 1470 const IPC::Message* msg = sink_->GetMessageAt(0); | 1471 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1471 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1472 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1472 ViewMsg_Resize::Param params; | 1473 ViewMsg_Resize::Param params; |
| 1473 ViewMsg_Resize::Read(msg, ¶ms); | 1474 ViewMsg_Resize::Read(msg, ¶ms); |
| 1474 EXPECT_EQ(size2.ToString(), params.a.new_size.ToString()); | 1475 EXPECT_EQ(size2.ToString(), get<0>(params).new_size.ToString()); |
| 1475 } | 1476 } |
| 1476 // Send resize ack to observe new Resize messages. | 1477 // Send resize ack to observe new Resize messages. |
| 1477 update_params.view_size = size2; | 1478 update_params.view_size = size2; |
| 1478 widget_host_->OnMessageReceived( | 1479 widget_host_->OnMessageReceived( |
| 1479 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); | 1480 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); |
| 1480 sink_->ClearMessages(); | 1481 sink_->ClearMessages(); |
| 1481 | 1482 |
| 1482 // Resize renderer again, before receiving a frame. Should not produce a | 1483 // Resize renderer again, before receiving a frame. Should not produce a |
| 1483 // Resize message. | 1484 // Resize message. |
| 1484 view_->SetSize(size3); | 1485 view_->SetSize(size3); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1515 root_window->GetHost()->compositor()); | 1516 root_window->GetHost()->compositor()); |
| 1516 EXPECT_EQ(size3.ToString(), view_->GetRequestedRendererSize().ToString()); | 1517 EXPECT_EQ(size3.ToString(), view_->GetRequestedRendererSize().ToString()); |
| 1517 EXPECT_EQ(2u, sink_->message_count()); | 1518 EXPECT_EQ(2u, sink_->message_count()); |
| 1518 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID, | 1519 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID, |
| 1519 sink_->GetMessageAt(0)->type()); | 1520 sink_->GetMessageAt(0)->type()); |
| 1520 { | 1521 { |
| 1521 const IPC::Message* msg = sink_->GetMessageAt(1); | 1522 const IPC::Message* msg = sink_->GetMessageAt(1); |
| 1522 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1523 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
| 1523 ViewMsg_Resize::Param params; | 1524 ViewMsg_Resize::Param params; |
| 1524 ViewMsg_Resize::Read(msg, ¶ms); | 1525 ViewMsg_Resize::Read(msg, ¶ms); |
| 1525 EXPECT_EQ(size3.ToString(), params.a.new_size.ToString()); | 1526 EXPECT_EQ(size3.ToString(), get<0>(params).new_size.ToString()); |
| 1526 } | 1527 } |
| 1527 update_params.view_size = size3; | 1528 update_params.view_size = size3; |
| 1528 widget_host_->OnMessageReceived( | 1529 widget_host_->OnMessageReceived( |
| 1529 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); | 1530 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); |
| 1530 sink_->ClearMessages(); | 1531 sink_->ClearMessages(); |
| 1531 } | 1532 } |
| 1532 | 1533 |
| 1533 // Skipped frames should not drop their damage. | 1534 // Skipped frames should not drop their damage. |
| 1534 TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { | 1535 TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { |
| 1535 gfx::Rect view_rect(100, 100); | 1536 gfx::Rect view_rect(100, 100); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 view_->SetInsets(gfx::Insets(0, 0, 40, 0)); | 2090 view_->SetInsets(gfx::Insets(0, 0, 40, 0)); |
| 2090 | 2091 |
| 2091 EXPECT_EQ(60, view_->GetVisibleViewportSize().height()); | 2092 EXPECT_EQ(60, view_->GetVisibleViewportSize().height()); |
| 2092 | 2093 |
| 2093 const IPC::Message *message = sink_->GetFirstMessageMatching( | 2094 const IPC::Message *message = sink_->GetFirstMessageMatching( |
| 2094 ViewMsg_Resize::ID); | 2095 ViewMsg_Resize::ID); |
| 2095 ASSERT_TRUE(message != NULL); | 2096 ASSERT_TRUE(message != NULL); |
| 2096 | 2097 |
| 2097 ViewMsg_Resize::Param params; | 2098 ViewMsg_Resize::Param params; |
| 2098 ViewMsg_Resize::Read(message, ¶ms); | 2099 ViewMsg_Resize::Read(message, ¶ms); |
| 2099 EXPECT_EQ(60, params.a.visible_viewport_size.height()); | 2100 EXPECT_EQ(60, get<0>(params).visible_viewport_size.height()); |
| 2100 } | 2101 } |
| 2101 | 2102 |
| 2102 // Ensures that touch event positions are never truncated to integers. | 2103 // Ensures that touch event positions are never truncated to integers. |
| 2103 TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) { | 2104 TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) { |
| 2104 const float kX = 30.58f; | 2105 const float kX = 30.58f; |
| 2105 const float kY = 50.23f; | 2106 const float kY = 50.23f; |
| 2106 | 2107 |
| 2107 view_->InitAsChild(NULL); | 2108 view_->InitAsChild(NULL); |
| 2108 view_->Show(); | 2109 view_->Show(); |
| 2109 | 2110 |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3064 const NativeWebKeyboardEvent* event = delegate_.last_event(); | 3065 const NativeWebKeyboardEvent* event = delegate_.last_event(); |
| 3065 EXPECT_NE(nullptr, event); | 3066 EXPECT_NE(nullptr, event); |
| 3066 if (event) { | 3067 if (event) { |
| 3067 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode); | 3068 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode); |
| 3068 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()), | 3069 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()), |
| 3069 event->nativeKeyCode); | 3070 event->nativeKeyCode); |
| 3070 } | 3071 } |
| 3071 } | 3072 } |
| 3072 | 3073 |
| 3073 } // namespace content | 3074 } // namespace content |
| OLD | NEW |