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/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 void AckLastSentInputEventIfNecessary(InputEventAckState ack_result) { | 471 void AckLastSentInputEventIfNecessary(InputEventAckState ack_result) { |
472 if (!sink_->message_count()) | 472 if (!sink_->message_count()) |
473 return; | 473 return; |
474 | 474 |
475 InputMsg_HandleInputEvent::Param params; | 475 InputMsg_HandleInputEvent::Param params; |
476 if (!InputMsg_HandleInputEvent::Read( | 476 if (!InputMsg_HandleInputEvent::Read( |
477 sink_->GetMessageAt(sink_->message_count() - 1), ¶ms)) { | 477 sink_->GetMessageAt(sink_->message_count() - 1), ¶ms)) { |
478 return; | 478 return; |
479 } | 479 } |
480 | 480 |
481 if (!WebInputEventTraits::WillReceiveAckFromRenderer(*get<0>(params))) | 481 if (!WebInputEventTraits::WillReceiveAckFromRenderer( |
| 482 *base::get<0>(params))) |
482 return; | 483 return; |
483 | 484 |
484 const blink::WebInputEvent* event = get<0>(params); | 485 const blink::WebInputEvent* event = base::get<0>(params); |
485 SendTouchEventACK(event->type, ack_result, | 486 SendTouchEventACK(event->type, ack_result, |
486 WebInputEventTraits::GetUniqueTouchEventId(*event)); | 487 WebInputEventTraits::GetUniqueTouchEventId(*event)); |
487 } | 488 } |
488 | 489 |
489 protected: | 490 protected: |
490 // If true, then calls RWH::Shutdown() instead of deleting RWH. | 491 // If true, then calls RWH::Shutdown() instead of deleting RWH. |
491 bool widget_host_uses_shutdown_to_destroy_; | 492 bool widget_host_uses_shutdown_to_destroy_; |
492 | 493 |
493 bool is_guest_view_hack_; | 494 bool is_guest_view_hack_; |
494 | 495 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 view_->SetCompositionText(composition_text); | 963 view_->SetCompositionText(composition_text); |
963 EXPECT_TRUE(view_->has_composition_text_); | 964 EXPECT_TRUE(view_->has_composition_text_); |
964 { | 965 { |
965 const IPC::Message* msg = | 966 const IPC::Message* msg = |
966 sink_->GetFirstMessageMatching(InputMsg_ImeSetComposition::ID); | 967 sink_->GetFirstMessageMatching(InputMsg_ImeSetComposition::ID); |
967 ASSERT_TRUE(msg != NULL); | 968 ASSERT_TRUE(msg != NULL); |
968 | 969 |
969 InputMsg_ImeSetComposition::Param params; | 970 InputMsg_ImeSetComposition::Param params; |
970 InputMsg_ImeSetComposition::Read(msg, ¶ms); | 971 InputMsg_ImeSetComposition::Read(msg, ¶ms); |
971 // composition text | 972 // composition text |
972 EXPECT_EQ(composition_text.text, get<0>(params)); | 973 EXPECT_EQ(composition_text.text, base::get<0>(params)); |
973 // underlines | 974 // underlines |
974 ASSERT_EQ(underlines.size(), get<1>(params).size()); | 975 ASSERT_EQ(underlines.size(), base::get<1>(params).size()); |
975 for (size_t i = 0; i < underlines.size(); ++i) { | 976 for (size_t i = 0; i < underlines.size(); ++i) { |
976 EXPECT_EQ(underlines[i].start_offset, get<1>(params)[i].startOffset); | 977 EXPECT_EQ(underlines[i].start_offset, |
977 EXPECT_EQ(underlines[i].end_offset, get<1>(params)[i].endOffset); | 978 base::get<1>(params)[i].startOffset); |
978 EXPECT_EQ(underlines[i].color, get<1>(params)[i].color); | 979 EXPECT_EQ(underlines[i].end_offset, base::get<1>(params)[i].endOffset); |
979 EXPECT_EQ(underlines[i].thick, get<1>(params)[i].thick); | 980 EXPECT_EQ(underlines[i].color, base::get<1>(params)[i].color); |
| 981 EXPECT_EQ(underlines[i].thick, base::get<1>(params)[i].thick); |
980 EXPECT_EQ(underlines[i].background_color, | 982 EXPECT_EQ(underlines[i].background_color, |
981 get<1>(params)[i].backgroundColor); | 983 base::get<1>(params)[i].backgroundColor); |
982 } | 984 } |
983 // highlighted range | 985 // highlighted range |
984 EXPECT_EQ(4, get<2>(params)) << "Should be the same to the caret pos"; | 986 EXPECT_EQ(4, base::get<2>(params)) << "Should be the same to the caret pos"; |
985 EXPECT_EQ(4, get<3>(params)) << "Should be the same to the caret pos"; | 987 EXPECT_EQ(4, base::get<3>(params)) << "Should be the same to the caret pos"; |
986 } | 988 } |
987 | 989 |
988 view_->ImeCancelComposition(); | 990 view_->ImeCancelComposition(); |
989 EXPECT_FALSE(view_->has_composition_text_); | 991 EXPECT_FALSE(view_->has_composition_text_); |
990 } | 992 } |
991 | 993 |
992 // Checks that sequence of IME-composition-event and mouse-event when mouse | 994 // Checks that sequence of IME-composition-event and mouse-event when mouse |
993 // clicking to cancel the composition. | 995 // clicking to cancel the composition. |
994 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { | 996 TEST_F(RenderWidgetHostViewAuraTest, FinishCompositionByMouse) { |
995 view_->InitAsChild(NULL); | 997 view_->InitAsChild(NULL); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 sink_->ClearMessages(); | 1284 sink_->ClearMessages(); |
1283 view_->SetSize(gfx::Size(100, 100)); | 1285 view_->SetSize(gfx::Size(100, 100)); |
1284 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); | 1286 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); |
1285 EXPECT_EQ(1u, sink_->message_count()); | 1287 EXPECT_EQ(1u, sink_->message_count()); |
1286 EXPECT_EQ(ViewMsg_Resize::ID, sink_->GetMessageAt(0)->type()); | 1288 EXPECT_EQ(ViewMsg_Resize::ID, sink_->GetMessageAt(0)->type()); |
1287 { | 1289 { |
1288 const IPC::Message* msg = sink_->GetMessageAt(0); | 1290 const IPC::Message* msg = sink_->GetMessageAt(0); |
1289 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1291 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
1290 ViewMsg_Resize::Param params; | 1292 ViewMsg_Resize::Param params; |
1291 ViewMsg_Resize::Read(msg, ¶ms); | 1293 ViewMsg_Resize::Read(msg, ¶ms); |
1292 EXPECT_EQ("100x100", get<0>(params).new_size.ToString()); // dip size | 1294 EXPECT_EQ("100x100", base::get<0>(params).new_size.ToString()); // dip size |
1293 EXPECT_EQ("100x100", | 1295 EXPECT_EQ("100x100", |
1294 get<0>(params).physical_backing_size.ToString()); // backing size | 1296 base::get<0>(params).physical_backing_size.ToString()); // backing size |
1295 } | 1297 } |
1296 | 1298 |
1297 widget_host_->ResetSizeAndRepaintPendingFlags(); | 1299 widget_host_->ResetSizeAndRepaintPendingFlags(); |
1298 sink_->ClearMessages(); | 1300 sink_->ClearMessages(); |
1299 | 1301 |
1300 aura_test_helper_->test_screen()->SetDeviceScaleFactor(2.0f); | 1302 aura_test_helper_->test_screen()->SetDeviceScaleFactor(2.0f); |
1301 EXPECT_EQ("200x200", view_->GetPhysicalBackingSize().ToString()); | 1303 EXPECT_EQ("200x200", view_->GetPhysicalBackingSize().ToString()); |
1302 // Extra ScreenInfoChanged message for |parent_view_|. | 1304 // Extra ScreenInfoChanged message for |parent_view_|. |
1303 EXPECT_EQ(1u, sink_->message_count()); | 1305 EXPECT_EQ(1u, sink_->message_count()); |
1304 { | 1306 { |
1305 const IPC::Message* msg = sink_->GetMessageAt(0); | 1307 const IPC::Message* msg = sink_->GetMessageAt(0); |
1306 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1308 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
1307 ViewMsg_Resize::Param params; | 1309 ViewMsg_Resize::Param params; |
1308 ViewMsg_Resize::Read(msg, ¶ms); | 1310 ViewMsg_Resize::Read(msg, ¶ms); |
1309 EXPECT_EQ(2.0f, get<0>(params).screen_info.deviceScaleFactor); | 1311 EXPECT_EQ(2.0f, base::get<0>(params).screen_info.deviceScaleFactor); |
1310 EXPECT_EQ("100x100", get<0>(params).new_size.ToString()); // dip size | 1312 EXPECT_EQ("100x100", base::get<0>(params).new_size.ToString()); // dip size |
1311 EXPECT_EQ("200x200", | 1313 EXPECT_EQ("200x200", |
1312 get<0>(params).physical_backing_size.ToString()); // backing size | 1314 base::get<0>(params).physical_backing_size.ToString()); // backing size |
1313 } | 1315 } |
1314 | 1316 |
1315 widget_host_->ResetSizeAndRepaintPendingFlags(); | 1317 widget_host_->ResetSizeAndRepaintPendingFlags(); |
1316 sink_->ClearMessages(); | 1318 sink_->ClearMessages(); |
1317 | 1319 |
1318 aura_test_helper_->test_screen()->SetDeviceScaleFactor(1.0f); | 1320 aura_test_helper_->test_screen()->SetDeviceScaleFactor(1.0f); |
1319 // Extra ScreenInfoChanged message for |parent_view_|. | 1321 // Extra ScreenInfoChanged message for |parent_view_|. |
1320 EXPECT_EQ(1u, sink_->message_count()); | 1322 EXPECT_EQ(1u, sink_->message_count()); |
1321 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); | 1323 EXPECT_EQ("100x100", view_->GetPhysicalBackingSize().ToString()); |
1322 { | 1324 { |
1323 const IPC::Message* msg = sink_->GetMessageAt(0); | 1325 const IPC::Message* msg = sink_->GetMessageAt(0); |
1324 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1326 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
1325 ViewMsg_Resize::Param params; | 1327 ViewMsg_Resize::Param params; |
1326 ViewMsg_Resize::Read(msg, ¶ms); | 1328 ViewMsg_Resize::Read(msg, ¶ms); |
1327 EXPECT_EQ(1.0f, get<0>(params).screen_info.deviceScaleFactor); | 1329 EXPECT_EQ(1.0f, base::get<0>(params).screen_info.deviceScaleFactor); |
1328 EXPECT_EQ("100x100", get<0>(params).new_size.ToString()); // dip size | 1330 EXPECT_EQ("100x100", base::get<0>(params).new_size.ToString()); // dip size |
1329 EXPECT_EQ("100x100", | 1331 EXPECT_EQ("100x100", |
1330 get<0>(params).physical_backing_size.ToString()); // backing size | 1332 base::get<0>(params).physical_backing_size.ToString()); // backing size |
1331 } | 1333 } |
1332 } | 1334 } |
1333 | 1335 |
1334 // Checks that InputMsg_CursorVisibilityChange IPC messages are dispatched | 1336 // Checks that InputMsg_CursorVisibilityChange IPC messages are dispatched |
1335 // to the renderer at the correct times. | 1337 // to the renderer at the correct times. |
1336 TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) { | 1338 TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) { |
1337 view_->InitAsChild(NULL); | 1339 view_->InitAsChild(NULL); |
1338 aura::client::ParentWindowWithContext( | 1340 aura::client::ParentWindowWithContext( |
1339 view_->GetNativeView(), | 1341 view_->GetNativeView(), |
1340 parent_view_->GetNativeView()->GetRootWindow(), | 1342 parent_view_->GetNativeView()->GetRootWindow(), |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 | 1487 |
1486 // Call WasResized to flush the old screen info. | 1488 // Call WasResized to flush the old screen info. |
1487 view_->GetRenderWidgetHost()->WasResized(); | 1489 view_->GetRenderWidgetHost()->WasResized(); |
1488 { | 1490 { |
1489 // 0 is CreatingNew message. | 1491 // 0 is CreatingNew message. |
1490 const IPC::Message* msg = sink_->GetMessageAt(0); | 1492 const IPC::Message* msg = sink_->GetMessageAt(0); |
1491 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1493 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
1492 ViewMsg_Resize::Param params; | 1494 ViewMsg_Resize::Param params; |
1493 ViewMsg_Resize::Read(msg, ¶ms); | 1495 ViewMsg_Resize::Read(msg, ¶ms); |
1494 EXPECT_EQ("0,0 800x600", | 1496 EXPECT_EQ("0,0 800x600", |
1495 gfx::Rect(get<0>(params).screen_info.availableRect).ToString()); | 1497 gfx::Rect( |
1496 EXPECT_EQ("800x600", get<0>(params).new_size.ToString()); | 1498 base::get<0>(params).screen_info.availableRect).ToString()); |
| 1499 EXPECT_EQ("800x600", base::get<0>(params).new_size.ToString()); |
1497 // Resizes are blocked until we swapped a frame of the correct size, and | 1500 // Resizes are blocked until we swapped a frame of the correct size, and |
1498 // we've committed it. | 1501 // we've committed it. |
1499 view_->OnSwapCompositorFrame( | 1502 view_->OnSwapCompositorFrame( |
1500 0, | 1503 0, |
1501 MakeDelegatedFrame( | 1504 MakeDelegatedFrame( |
1502 1.f, get<0>(params).new_size, gfx::Rect(get<0>(params).new_size))); | 1505 1.f, base::get<0>(params).new_size, |
| 1506 gfx::Rect(base::get<0>(params).new_size))); |
1503 ui::DrawWaiterForTest::WaitForCommit( | 1507 ui::DrawWaiterForTest::WaitForCommit( |
1504 root_window->GetHost()->compositor()); | 1508 root_window->GetHost()->compositor()); |
1505 } | 1509 } |
1506 | 1510 |
1507 widget_host_->ResetSizeAndRepaintPendingFlags(); | 1511 widget_host_->ResetSizeAndRepaintPendingFlags(); |
1508 sink_->ClearMessages(); | 1512 sink_->ClearMessages(); |
1509 | 1513 |
1510 // Make sure the corrent screen size is set along in the resize | 1514 // Make sure the corrent screen size is set along in the resize |
1511 // request when the screen size has changed. | 1515 // request when the screen size has changed. |
1512 aura_test_helper_->test_screen()->SetUIScale(0.5); | 1516 aura_test_helper_->test_screen()->SetUIScale(0.5); |
1513 EXPECT_EQ(1u, sink_->message_count()); | 1517 EXPECT_EQ(1u, sink_->message_count()); |
1514 { | 1518 { |
1515 const IPC::Message* msg = sink_->GetMessageAt(0); | 1519 const IPC::Message* msg = sink_->GetMessageAt(0); |
1516 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1520 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
1517 ViewMsg_Resize::Param params; | 1521 ViewMsg_Resize::Param params; |
1518 ViewMsg_Resize::Read(msg, ¶ms); | 1522 ViewMsg_Resize::Read(msg, ¶ms); |
1519 EXPECT_EQ("0,0 1600x1200", | 1523 EXPECT_EQ("0,0 1600x1200", |
1520 gfx::Rect(get<0>(params).screen_info.availableRect).ToString()); | 1524 gfx::Rect( |
1521 EXPECT_EQ("1600x1200", get<0>(params).new_size.ToString()); | 1525 base::get<0>(params).screen_info.availableRect).ToString()); |
| 1526 EXPECT_EQ("1600x1200", base::get<0>(params).new_size.ToString()); |
1522 view_->OnSwapCompositorFrame( | 1527 view_->OnSwapCompositorFrame( |
1523 0, | 1528 0, |
1524 MakeDelegatedFrame( | 1529 MakeDelegatedFrame( |
1525 1.f, get<0>(params).new_size, gfx::Rect(get<0>(params).new_size))); | 1530 1.f, base::get<0>(params).new_size, |
| 1531 gfx::Rect(base::get<0>(params).new_size))); |
1526 ui::DrawWaiterForTest::WaitForCommit( | 1532 ui::DrawWaiterForTest::WaitForCommit( |
1527 root_window->GetHost()->compositor()); | 1533 root_window->GetHost()->compositor()); |
1528 } | 1534 } |
1529 } | 1535 } |
1530 | 1536 |
1531 // Swapping a frame should notify the window. | 1537 // Swapping a frame should notify the window. |
1532 TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { | 1538 TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { |
1533 gfx::Size view_size(100, 100); | 1539 gfx::Size view_size(100, 100); |
1534 gfx::Rect view_rect(view_size); | 1540 gfx::Rect view_rect(view_size); |
1535 | 1541 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 | 1620 |
1615 // Resize renderer, should produce a Resize message | 1621 // Resize renderer, should produce a Resize message |
1616 view_->SetSize(size2); | 1622 view_->SetSize(size2); |
1617 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); | 1623 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); |
1618 EXPECT_EQ(1u, sink_->message_count()); | 1624 EXPECT_EQ(1u, sink_->message_count()); |
1619 { | 1625 { |
1620 const IPC::Message* msg = sink_->GetMessageAt(0); | 1626 const IPC::Message* msg = sink_->GetMessageAt(0); |
1621 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 1627 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
1622 ViewMsg_Resize::Param params; | 1628 ViewMsg_Resize::Param params; |
1623 ViewMsg_Resize::Read(msg, ¶ms); | 1629 ViewMsg_Resize::Read(msg, ¶ms); |
1624 EXPECT_EQ(size2.ToString(), get<0>(params).new_size.ToString()); | 1630 EXPECT_EQ(size2.ToString(), base::get<0>(params).new_size.ToString()); |
1625 } | 1631 } |
1626 // Send resize ack to observe new Resize messages. | 1632 // Send resize ack to observe new Resize messages. |
1627 update_params.view_size = size2; | 1633 update_params.view_size = size2; |
1628 widget_host_->OnMessageReceived( | 1634 widget_host_->OnMessageReceived( |
1629 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); | 1635 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); |
1630 sink_->ClearMessages(); | 1636 sink_->ClearMessages(); |
1631 | 1637 |
1632 // Resize renderer again, before receiving a frame. Should not produce a | 1638 // Resize renderer again, before receiving a frame. Should not produce a |
1633 // Resize message. | 1639 // Resize message. |
1634 view_->SetSize(size3); | 1640 view_->SetSize(size3); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 const IPC::Message* msg = sink_->GetMessageAt(i); | 1675 const IPC::Message* msg = sink_->GetMessageAt(i); |
1670 switch (msg->type()) { | 1676 switch (msg->type()) { |
1671 case InputMsg_HandleInputEvent::ID: { | 1677 case InputMsg_HandleInputEvent::ID: { |
1672 // On some platforms, the call to view_->Show() causes a posted task to | 1678 // On some platforms, the call to view_->Show() causes a posted task to |
1673 // call | 1679 // call |
1674 // ui::WindowEventDispatcher::SynthesizeMouseMoveAfterChangeToWindow, | 1680 // ui::WindowEventDispatcher::SynthesizeMouseMoveAfterChangeToWindow, |
1675 // which the above WaitForCommit may cause to be picked up. Be robust | 1681 // which the above WaitForCommit may cause to be picked up. Be robust |
1676 // to this extra IPC coming in. | 1682 // to this extra IPC coming in. |
1677 InputMsg_HandleInputEvent::Param params; | 1683 InputMsg_HandleInputEvent::Param params; |
1678 InputMsg_HandleInputEvent::Read(msg, ¶ms); | 1684 InputMsg_HandleInputEvent::Read(msg, ¶ms); |
1679 const blink::WebInputEvent* event = get<0>(params); | 1685 const blink::WebInputEvent* event = base::get<0>(params); |
1680 EXPECT_EQ(blink::WebInputEvent::MouseMove, event->type); | 1686 EXPECT_EQ(blink::WebInputEvent::MouseMove, event->type); |
1681 break; | 1687 break; |
1682 } | 1688 } |
1683 case ViewMsg_SwapCompositorFrameAck::ID: | 1689 case ViewMsg_SwapCompositorFrameAck::ID: |
1684 break; | 1690 break; |
1685 case ViewMsg_Resize::ID: { | 1691 case ViewMsg_Resize::ID: { |
1686 EXPECT_FALSE(has_resize); | 1692 EXPECT_FALSE(has_resize); |
1687 ViewMsg_Resize::Param params; | 1693 ViewMsg_Resize::Param params; |
1688 ViewMsg_Resize::Read(msg, ¶ms); | 1694 ViewMsg_Resize::Read(msg, ¶ms); |
1689 EXPECT_EQ(size3.ToString(), get<0>(params).new_size.ToString()); | 1695 EXPECT_EQ(size3.ToString(), base::get<0>(params).new_size.ToString()); |
1690 has_resize = true; | 1696 has_resize = true; |
1691 break; | 1697 break; |
1692 } | 1698 } |
1693 default: | 1699 default: |
1694 ADD_FAILURE() << "Unexpected message " << msg->type(); | 1700 ADD_FAILURE() << "Unexpected message " << msg->type(); |
1695 break; | 1701 break; |
1696 } | 1702 } |
1697 } | 1703 } |
1698 EXPECT_TRUE(has_resize); | 1704 EXPECT_TRUE(has_resize); |
1699 update_params.view_size = size3; | 1705 update_params.view_size = size3; |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 view_->SetInsets(gfx::Insets(0, 0, 40, 0)); | 2372 view_->SetInsets(gfx::Insets(0, 0, 40, 0)); |
2367 | 2373 |
2368 EXPECT_EQ(60, view_->GetVisibleViewportSize().height()); | 2374 EXPECT_EQ(60, view_->GetVisibleViewportSize().height()); |
2369 | 2375 |
2370 const IPC::Message *message = sink_->GetFirstMessageMatching( | 2376 const IPC::Message *message = sink_->GetFirstMessageMatching( |
2371 ViewMsg_Resize::ID); | 2377 ViewMsg_Resize::ID); |
2372 ASSERT_TRUE(message != NULL); | 2378 ASSERT_TRUE(message != NULL); |
2373 | 2379 |
2374 ViewMsg_Resize::Param params; | 2380 ViewMsg_Resize::Param params; |
2375 ViewMsg_Resize::Read(message, ¶ms); | 2381 ViewMsg_Resize::Read(message, ¶ms); |
2376 EXPECT_EQ(60, get<0>(params).visible_viewport_size.height()); | 2382 EXPECT_EQ(60, base::get<0>(params).visible_viewport_size.height()); |
2377 } | 2383 } |
2378 | 2384 |
2379 // Ensures that touch event positions are never truncated to integers. | 2385 // Ensures that touch event positions are never truncated to integers. |
2380 TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) { | 2386 TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) { |
2381 const float kX = 30.58f; | 2387 const float kX = 30.58f; |
2382 const float kY = 50.23f; | 2388 const float kY = 50.23f; |
2383 | 2389 |
2384 view_->InitAsChild(NULL); | 2390 view_->InitAsChild(NULL); |
2385 view_->Show(); | 2391 view_->Show(); |
2386 | 2392 |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3493 const IPC::Message* msg = | 3499 const IPC::Message* msg = |
3494 sink_->GetUniqueMessageMatching(ViewMsg_SetSurfaceIdNamespace::ID); | 3500 sink_->GetUniqueMessageMatching(ViewMsg_SetSurfaceIdNamespace::ID); |
3495 EXPECT_TRUE(msg); | 3501 EXPECT_TRUE(msg); |
3496 ViewMsg_SetSurfaceIdNamespace::Param params; | 3502 ViewMsg_SetSurfaceIdNamespace::Param params; |
3497 ViewMsg_SetSurfaceIdNamespace::Read(msg, ¶ms); | 3503 ViewMsg_SetSurfaceIdNamespace::Read(msg, ¶ms); |
3498 view_->InitAsChild(NULL); | 3504 view_->InitAsChild(NULL); |
3499 view_->Show(); | 3505 view_->Show(); |
3500 view_->SetSize(size); | 3506 view_->SetSize(size); |
3501 view_->OnSwapCompositorFrame(0, | 3507 view_->OnSwapCompositorFrame(0, |
3502 MakeDelegatedFrame(1.f, size, gfx::Rect(size))); | 3508 MakeDelegatedFrame(1.f, size, gfx::Rect(size))); |
3503 EXPECT_EQ(view_->GetSurfaceIdNamespace(), get<0>(params)); | 3509 EXPECT_EQ(view_->GetSurfaceIdNamespace(), base::get<0>(params)); |
3504 } | 3510 } |
3505 | 3511 |
3506 } // namespace content | 3512 } // namespace content |
OLD | NEW |