| 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/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 883 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 884 | 884 |
| 885 // Scroll the parent frame downward to verify that the child rect gets updated | 885 // Scroll the parent frame downward to verify that the child rect gets updated |
| 886 // correctly. | 886 // correctly. |
| 887 blink::WebMouseWheelEvent scroll_event; | 887 blink::WebMouseWheelEvent scroll_event; |
| 888 scroll_event.type = blink::WebInputEvent::MouseWheel; | 888 scroll_event.type = blink::WebInputEvent::MouseWheel; |
| 889 scroll_event.x = 387; | 889 scroll_event.x = 387; |
| 890 scroll_event.y = 110; | 890 scroll_event.y = 110; |
| 891 scroll_event.deltaX = 0.0f; | 891 scroll_event.deltaX = 0.0f; |
| 892 scroll_event.deltaY = -30.0f; | 892 scroll_event.deltaY = -30.0f; |
| 893 rwhv_root->ProcessMouseWheelEvent(scroll_event); | 893 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 894 | 894 |
| 895 filter->Wait(); | 895 filter->Wait(); |
| 896 | 896 |
| 897 // The precise amount of scroll for the first view position update is not | 897 // The precise amount of scroll for the first view position update is not |
| 898 // deterministic, so this simply verifies that the OOPIF moved from its | 898 // deterministic, so this simply verifies that the OOPIF moved from its |
| 899 // earlier position. | 899 // earlier position. |
| 900 gfx::Rect update_rect = filter->last_rect(); | 900 gfx::Rect update_rect = filter->last_rect(); |
| 901 EXPECT_LT(update_rect.y(), bounds.y() - rwhv_root->GetViewBounds().y()); | 901 EXPECT_LT(update_rect.y(), bounds.y() - rwhv_root->GetViewBounds().y()); |
| 902 } | 902 } |
| 903 | 903 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 int initial_y = update_rect.y(); | 969 int initial_y = update_rect.y(); |
| 970 filter->Reset(); | 970 filter->Reset(); |
| 971 | 971 |
| 972 // Scroll the parent frame downward. | 972 // Scroll the parent frame downward. |
| 973 blink::WebMouseWheelEvent scroll_event; | 973 blink::WebMouseWheelEvent scroll_event; |
| 974 scroll_event.type = blink::WebInputEvent::MouseWheel; | 974 scroll_event.type = blink::WebInputEvent::MouseWheel; |
| 975 scroll_event.x = 1; | 975 scroll_event.x = 1; |
| 976 scroll_event.y = 1; | 976 scroll_event.y = 1; |
| 977 scroll_event.deltaX = 0.0f; | 977 scroll_event.deltaX = 0.0f; |
| 978 scroll_event.deltaY = -5.0f; | 978 scroll_event.deltaY = -5.0f; |
| 979 rwhv_parent->ProcessMouseWheelEvent(scroll_event); | 979 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 980 | 980 |
| 981 // Ensure that the view position is propagated to the child properly. | 981 // Ensure that the view position is propagated to the child properly. |
| 982 filter->Wait(); | 982 filter->Wait(); |
| 983 update_rect = filter->last_rect(); | 983 update_rect = filter->last_rect(); |
| 984 EXPECT_LT(update_rect.y(), initial_y); | 984 EXPECT_LT(update_rect.y(), initial_y); |
| 985 filter->Reset(); | 985 filter->Reset(); |
| 986 | 986 |
| 987 // Now scroll the nested frame upward, which should bubble to the parent. | 987 // Now scroll the nested frame upward, which should bubble to the parent. |
| 988 // The upscroll exceeds the amount that the frame was initially scrolled | 988 // The upscroll exceeds the amount that the frame was initially scrolled |
| 989 // down to account for rounding. | 989 // down to account for rounding. |
| 990 scroll_event.deltaY = 6.0f; | 990 scroll_event.deltaY = 6.0f; |
| 991 rwhv_nested->ProcessMouseWheelEvent(scroll_event); | 991 rwhv_nested->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 992 | 992 |
| 993 filter->Wait(); | 993 filter->Wait(); |
| 994 // This loop isn't great, but it accounts for the possibility of multiple | 994 // This loop isn't great, but it accounts for the possibility of multiple |
| 995 // incremental updates happening as a result of the scroll animation. | 995 // incremental updates happening as a result of the scroll animation. |
| 996 // A failure condition of this test is that the loop might not terminate | 996 // A failure condition of this test is that the loop might not terminate |
| 997 // due to bubbling not working properly. If the overscroll bubbles to the | 997 // due to bubbling not working properly. If the overscroll bubbles to the |
| 998 // parent iframe then the nested frame's y coord will return to its | 998 // parent iframe then the nested frame's y coord will return to its |
| 999 // initial position. | 999 // initial position. |
| 1000 update_rect = filter->last_rect(); | 1000 update_rect = filter->last_rect(); |
| 1001 while (update_rect.y() > initial_y) { | 1001 while (update_rect.y() > initial_y) { |
| 1002 base::RunLoop run_loop; | 1002 base::RunLoop run_loop; |
| 1003 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1003 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1004 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 1004 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
| 1005 run_loop.Run(); | 1005 run_loop.Run(); |
| 1006 update_rect = filter->last_rect(); | 1006 update_rect = filter->last_rect(); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 filter->Reset(); | 1009 filter->Reset(); |
| 1010 | 1010 |
| 1011 // Scroll the parent down again in order to test scroll bubbling from | 1011 // Scroll the parent down again in order to test scroll bubbling from |
| 1012 // gestures. | 1012 // gestures. |
| 1013 scroll_event.deltaY = -5.0f; | 1013 scroll_event.deltaY = -5.0f; |
| 1014 rwhv_parent->ProcessMouseWheelEvent(scroll_event); | 1014 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 1015 | 1015 |
| 1016 // Ensure ensuing offset change is received, and then reset the filter. | 1016 // Ensure ensuing offset change is received, and then reset the filter. |
| 1017 filter->Wait(); | 1017 filter->Wait(); |
| 1018 filter->Reset(); | 1018 filter->Reset(); |
| 1019 | 1019 |
| 1020 // Scroll down the nested iframe via gesture. This requires 3 separate input | 1020 // Scroll down the nested iframe via gesture. This requires 3 separate input |
| 1021 // events. | 1021 // events. |
| 1022 blink::WebGestureEvent gesture_event; | 1022 blink::WebGestureEvent gesture_event; |
| 1023 gesture_event.type = blink::WebGestureEvent::GestureScrollBegin; | 1023 gesture_event.type = blink::WebGestureEvent::GestureScrollBegin; |
| 1024 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; | 1024 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; |
| (...skipping 4318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5343 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); | 5343 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); |
| 5344 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 5344 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 5345 | 5345 |
| 5346 // Target left-click event to child frame. | 5346 // Target left-click event to child frame. |
| 5347 blink::WebMouseEvent click_event; | 5347 blink::WebMouseEvent click_event; |
| 5348 click_event.type = blink::WebInputEvent::MouseDown; | 5348 click_event.type = blink::WebInputEvent::MouseDown; |
| 5349 click_event.button = blink::WebPointerProperties::ButtonLeft; | 5349 click_event.button = blink::WebPointerProperties::ButtonLeft; |
| 5350 click_event.x = 15; | 5350 click_event.x = 15; |
| 5351 click_event.y = 15; | 5351 click_event.y = 15; |
| 5352 click_event.clickCount = 1; | 5352 click_event.clickCount = 1; |
| 5353 rwhv_child->ProcessMouseEvent(click_event); | 5353 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5354 | 5354 |
| 5355 // Dismiss the popup. | 5355 // Dismiss the popup. |
| 5356 click_event.x = 1; | 5356 click_event.x = 1; |
| 5357 click_event.y = 1; | 5357 click_event.y = 1; |
| 5358 rwhv_child->ProcessMouseEvent(click_event); | 5358 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5359 | 5359 |
| 5360 filter->Wait(); | 5360 filter->Wait(); |
| 5361 gfx::Rect popup_rect = filter->last_initial_rect(); | 5361 gfx::Rect popup_rect = filter->last_initial_rect(); |
| 5362 #if defined(OS_MACOSX) | 5362 #if defined(OS_MACOSX) |
| 5363 // On Mac we receive the coordinates before they are transformed, so they | 5363 // On Mac we receive the coordinates before they are transformed, so they |
| 5364 // are still relative to the out-of-process iframe origin. | 5364 // are still relative to the out-of-process iframe origin. |
| 5365 EXPECT_EQ(popup_rect.x(), 9); | 5365 EXPECT_EQ(popup_rect.x(), 9); |
| 5366 EXPECT_EQ(popup_rect.y(), 9); | 5366 EXPECT_EQ(popup_rect.y(), 9); |
| 5367 #else | 5367 #else |
| 5368 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); | 5368 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5418 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); | 5418 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); |
| 5419 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 5419 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 5420 | 5420 |
| 5421 // Target left-click event to child frame. | 5421 // Target left-click event to child frame. |
| 5422 blink::WebMouseEvent click_event; | 5422 blink::WebMouseEvent click_event; |
| 5423 click_event.type = blink::WebInputEvent::MouseDown; | 5423 click_event.type = blink::WebInputEvent::MouseDown; |
| 5424 click_event.button = blink::WebPointerProperties::ButtonLeft; | 5424 click_event.button = blink::WebPointerProperties::ButtonLeft; |
| 5425 click_event.x = 15; | 5425 click_event.x = 15; |
| 5426 click_event.y = 15; | 5426 click_event.y = 15; |
| 5427 click_event.clickCount = 1; | 5427 click_event.clickCount = 1; |
| 5428 rwhv_c_node->ProcessMouseEvent(click_event); | 5428 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5429 | 5429 |
| 5430 // Prompt the WebContents to dismiss the popup by clicking elsewhere. | 5430 // Prompt the WebContents to dismiss the popup by clicking elsewhere. |
| 5431 click_event.x = 1; | 5431 click_event.x = 1; |
| 5432 click_event.y = 1; | 5432 click_event.y = 1; |
| 5433 rwhv_c_node->ProcessMouseEvent(click_event); | 5433 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5434 | 5434 |
| 5435 filter->Wait(); | 5435 filter->Wait(); |
| 5436 | 5436 |
| 5437 gfx::Rect popup_rect = filter->last_initial_rect(); | 5437 gfx::Rect popup_rect = filter->last_initial_rect(); |
| 5438 | 5438 |
| 5439 #if defined(OS_MACOSX) | 5439 #if defined(OS_MACOSX) |
| 5440 EXPECT_EQ(popup_rect.x(), 9); | 5440 EXPECT_EQ(popup_rect.x(), 9); |
| 5441 EXPECT_EQ(popup_rect.y(), 9); | 5441 EXPECT_EQ(popup_rect.y(), 9); |
| 5442 #else | 5442 #else |
| 5443 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); | 5443 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5468 base::RunLoop run_loop; | 5468 base::RunLoop run_loop; |
| 5469 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 5469 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 5470 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 5470 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
| 5471 run_loop.Run(); | 5471 run_loop.Run(); |
| 5472 } | 5472 } |
| 5473 | 5473 |
| 5474 click_event.button = blink::WebPointerProperties::ButtonLeft; | 5474 click_event.button = blink::WebPointerProperties::ButtonLeft; |
| 5475 click_event.x = 15; | 5475 click_event.x = 15; |
| 5476 click_event.y = 15; | 5476 click_event.y = 15; |
| 5477 click_event.clickCount = 1; | 5477 click_event.clickCount = 1; |
| 5478 rwhv_c_node->ProcessMouseEvent(click_event); | 5478 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5479 | 5479 |
| 5480 click_event.x = 1; | 5480 click_event.x = 1; |
| 5481 click_event.y = 1; | 5481 click_event.y = 1; |
| 5482 rwhv_c_node->ProcessMouseEvent(click_event); | 5482 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5483 | 5483 |
| 5484 filter->Wait(); | 5484 filter->Wait(); |
| 5485 | 5485 |
| 5486 popup_rect = filter->last_initial_rect(); | 5486 popup_rect = filter->last_initial_rect(); |
| 5487 | 5487 |
| 5488 #if defined(OS_MACOSX) | 5488 #if defined(OS_MACOSX) |
| 5489 EXPECT_EQ(popup_rect.x(), 9); | 5489 EXPECT_EQ(popup_rect.x(), 9); |
| 5490 EXPECT_EQ(popup_rect.y(), 9); | 5490 EXPECT_EQ(popup_rect.y(), 9); |
| 5491 #else | 5491 #else |
| 5492 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 203); | 5492 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 203); |
| (...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7209 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7209 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
| 7210 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7210 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7211 | 7211 |
| 7212 // Cross-site navigation should preserve the fullscreen flags. | 7212 // Cross-site navigation should preserve the fullscreen flags. |
| 7213 NavigateFrameToURL(root->child_at(0)->child_at(0), | 7213 NavigateFrameToURL(root->child_at(0)->child_at(0), |
| 7214 embedded_test_server()->GetURL("d.com", "/title1.html")); | 7214 embedded_test_server()->GetURL("d.com", "/title1.html")); |
| 7215 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7215 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7216 } | 7216 } |
| 7217 | 7217 |
| 7218 } // namespace content | 7218 } // namespace content |
| OLD | NEW |