| 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 896 root->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 897 | 897 |
| 898 // Scroll the parent frame downward to verify that the child rect gets updated | 898 // Scroll the parent frame downward to verify that the child rect gets updated |
| 899 // correctly. | 899 // correctly. |
| 900 blink::WebMouseWheelEvent scroll_event; | 900 blink::WebMouseWheelEvent scroll_event; |
| 901 scroll_event.type = blink::WebInputEvent::MouseWheel; | 901 scroll_event.type = blink::WebInputEvent::MouseWheel; |
| 902 scroll_event.x = 387; | 902 scroll_event.x = 387; |
| 903 scroll_event.y = 110; | 903 scroll_event.y = 110; |
| 904 scroll_event.deltaX = 0.0f; | 904 scroll_event.deltaX = 0.0f; |
| 905 scroll_event.deltaY = -30.0f; | 905 scroll_event.deltaY = -30.0f; |
| 906 rwhv_root->ProcessMouseWheelEvent(scroll_event); | 906 rwhv_root->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 907 | 907 |
| 908 filter->Wait(); | 908 filter->Wait(); |
| 909 | 909 |
| 910 // The precise amount of scroll for the first view position update is not | 910 // The precise amount of scroll for the first view position update is not |
| 911 // deterministic, so this simply verifies that the OOPIF moved from its | 911 // deterministic, so this simply verifies that the OOPIF moved from its |
| 912 // earlier position. | 912 // earlier position. |
| 913 gfx::Rect update_rect = filter->last_rect(); | 913 gfx::Rect update_rect = filter->last_rect(); |
| 914 EXPECT_LT(update_rect.y(), bounds.y() - rwhv_root->GetViewBounds().y()); | 914 EXPECT_LT(update_rect.y(), bounds.y() - rwhv_root->GetViewBounds().y()); |
| 915 } | 915 } |
| 916 | 916 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 int initial_y = update_rect.y(); | 982 int initial_y = update_rect.y(); |
| 983 filter->Reset(); | 983 filter->Reset(); |
| 984 | 984 |
| 985 // Scroll the parent frame downward. | 985 // Scroll the parent frame downward. |
| 986 blink::WebMouseWheelEvent scroll_event; | 986 blink::WebMouseWheelEvent scroll_event; |
| 987 scroll_event.type = blink::WebInputEvent::MouseWheel; | 987 scroll_event.type = blink::WebInputEvent::MouseWheel; |
| 988 scroll_event.x = 1; | 988 scroll_event.x = 1; |
| 989 scroll_event.y = 1; | 989 scroll_event.y = 1; |
| 990 scroll_event.deltaX = 0.0f; | 990 scroll_event.deltaX = 0.0f; |
| 991 scroll_event.deltaY = -5.0f; | 991 scroll_event.deltaY = -5.0f; |
| 992 rwhv_parent->ProcessMouseWheelEvent(scroll_event); | 992 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 993 | 993 |
| 994 // Ensure that the view position is propagated to the child properly. | 994 // Ensure that the view position is propagated to the child properly. |
| 995 filter->Wait(); | 995 filter->Wait(); |
| 996 update_rect = filter->last_rect(); | 996 update_rect = filter->last_rect(); |
| 997 EXPECT_LT(update_rect.y(), initial_y); | 997 EXPECT_LT(update_rect.y(), initial_y); |
| 998 filter->Reset(); | 998 filter->Reset(); |
| 999 | 999 |
| 1000 // Now scroll the nested frame upward, which should bubble to the parent. | 1000 // Now scroll the nested frame upward, which should bubble to the parent. |
| 1001 // The upscroll exceeds the amount that the frame was initially scrolled | 1001 // The upscroll exceeds the amount that the frame was initially scrolled |
| 1002 // down to account for rounding. | 1002 // down to account for rounding. |
| 1003 scroll_event.deltaY = 6.0f; | 1003 scroll_event.deltaY = 6.0f; |
| 1004 rwhv_nested->ProcessMouseWheelEvent(scroll_event); | 1004 rwhv_nested->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 1005 | 1005 |
| 1006 filter->Wait(); | 1006 filter->Wait(); |
| 1007 // This loop isn't great, but it accounts for the possibility of multiple | 1007 // This loop isn't great, but it accounts for the possibility of multiple |
| 1008 // incremental updates happening as a result of the scroll animation. | 1008 // incremental updates happening as a result of the scroll animation. |
| 1009 // A failure condition of this test is that the loop might not terminate | 1009 // A failure condition of this test is that the loop might not terminate |
| 1010 // due to bubbling not working properly. If the overscroll bubbles to the | 1010 // due to bubbling not working properly. If the overscroll bubbles to the |
| 1011 // parent iframe then the nested frame's y coord will return to its | 1011 // parent iframe then the nested frame's y coord will return to its |
| 1012 // initial position. | 1012 // initial position. |
| 1013 update_rect = filter->last_rect(); | 1013 update_rect = filter->last_rect(); |
| 1014 while (update_rect.y() > initial_y) { | 1014 while (update_rect.y() > initial_y) { |
| 1015 base::RunLoop run_loop; | 1015 base::RunLoop run_loop; |
| 1016 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1016 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1017 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 1017 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
| 1018 run_loop.Run(); | 1018 run_loop.Run(); |
| 1019 update_rect = filter->last_rect(); | 1019 update_rect = filter->last_rect(); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 filter->Reset(); | 1022 filter->Reset(); |
| 1023 | 1023 |
| 1024 // Scroll the parent down again in order to test scroll bubbling from | 1024 // Scroll the parent down again in order to test scroll bubbling from |
| 1025 // gestures. | 1025 // gestures. |
| 1026 scroll_event.deltaY = -5.0f; | 1026 scroll_event.deltaY = -5.0f; |
| 1027 rwhv_parent->ProcessMouseWheelEvent(scroll_event); | 1027 rwhv_parent->ProcessMouseWheelEvent(scroll_event, ui::LatencyInfo()); |
| 1028 | 1028 |
| 1029 // Ensure ensuing offset change is received, and then reset the filter. | 1029 // Ensure ensuing offset change is received, and then reset the filter. |
| 1030 filter->Wait(); | 1030 filter->Wait(); |
| 1031 filter->Reset(); | 1031 filter->Reset(); |
| 1032 | 1032 |
| 1033 // Scroll down the nested iframe via gesture. This requires 3 separate input | 1033 // Scroll down the nested iframe via gesture. This requires 3 separate input |
| 1034 // events. | 1034 // events. |
| 1035 blink::WebGestureEvent gesture_event; | 1035 blink::WebGestureEvent gesture_event; |
| 1036 gesture_event.type = blink::WebGestureEvent::GestureScrollBegin; | 1036 gesture_event.type = blink::WebGestureEvent::GestureScrollBegin; |
| 1037 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; | 1037 gesture_event.sourceDevice = blink::WebGestureDeviceTouchpad; |
| (...skipping 4304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5342 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); | 5342 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); |
| 5343 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 5343 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 5344 | 5344 |
| 5345 // Target left-click event to child frame. | 5345 // Target left-click event to child frame. |
| 5346 blink::WebMouseEvent click_event; | 5346 blink::WebMouseEvent click_event; |
| 5347 click_event.type = blink::WebInputEvent::MouseDown; | 5347 click_event.type = blink::WebInputEvent::MouseDown; |
| 5348 click_event.button = blink::WebPointerProperties::ButtonLeft; | 5348 click_event.button = blink::WebPointerProperties::ButtonLeft; |
| 5349 click_event.x = 15; | 5349 click_event.x = 15; |
| 5350 click_event.y = 15; | 5350 click_event.y = 15; |
| 5351 click_event.clickCount = 1; | 5351 click_event.clickCount = 1; |
| 5352 rwhv_child->ProcessMouseEvent(click_event); | 5352 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5353 | 5353 |
| 5354 // Dismiss the popup. | 5354 // Dismiss the popup. |
| 5355 click_event.x = 1; | 5355 click_event.x = 1; |
| 5356 click_event.y = 1; | 5356 click_event.y = 1; |
| 5357 rwhv_child->ProcessMouseEvent(click_event); | 5357 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5358 | 5358 |
| 5359 filter->Wait(); | 5359 filter->Wait(); |
| 5360 gfx::Rect popup_rect = filter->last_initial_rect(); | 5360 gfx::Rect popup_rect = filter->last_initial_rect(); |
| 5361 #if defined(OS_MACOSX) | 5361 #if defined(OS_MACOSX) |
| 5362 // On Mac we receive the coordinates before they are transformed, so they | 5362 // On Mac we receive the coordinates before they are transformed, so they |
| 5363 // are still relative to the out-of-process iframe origin. | 5363 // are still relative to the out-of-process iframe origin. |
| 5364 EXPECT_EQ(popup_rect.x(), 9); | 5364 EXPECT_EQ(popup_rect.x(), 9); |
| 5365 EXPECT_EQ(popup_rect.y(), 9); | 5365 EXPECT_EQ(popup_rect.y(), 9); |
| 5366 #else | 5366 #else |
| 5367 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); | 5367 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5417 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); | 5417 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); |
| 5418 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 5418 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 5419 | 5419 |
| 5420 // Target left-click event to child frame. | 5420 // Target left-click event to child frame. |
| 5421 blink::WebMouseEvent click_event; | 5421 blink::WebMouseEvent click_event; |
| 5422 click_event.type = blink::WebInputEvent::MouseDown; | 5422 click_event.type = blink::WebInputEvent::MouseDown; |
| 5423 click_event.button = blink::WebPointerProperties::ButtonLeft; | 5423 click_event.button = blink::WebPointerProperties::ButtonLeft; |
| 5424 click_event.x = 15; | 5424 click_event.x = 15; |
| 5425 click_event.y = 15; | 5425 click_event.y = 15; |
| 5426 click_event.clickCount = 1; | 5426 click_event.clickCount = 1; |
| 5427 rwhv_c_node->ProcessMouseEvent(click_event); | 5427 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5428 | 5428 |
| 5429 // Prompt the WebContents to dismiss the popup by clicking elsewhere. | 5429 // Prompt the WebContents to dismiss the popup by clicking elsewhere. |
| 5430 click_event.x = 1; | 5430 click_event.x = 1; |
| 5431 click_event.y = 1; | 5431 click_event.y = 1; |
| 5432 rwhv_c_node->ProcessMouseEvent(click_event); | 5432 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5433 | 5433 |
| 5434 filter->Wait(); | 5434 filter->Wait(); |
| 5435 | 5435 |
| 5436 gfx::Rect popup_rect = filter->last_initial_rect(); | 5436 gfx::Rect popup_rect = filter->last_initial_rect(); |
| 5437 | 5437 |
| 5438 #if defined(OS_MACOSX) | 5438 #if defined(OS_MACOSX) |
| 5439 EXPECT_EQ(popup_rect.x(), 9); | 5439 EXPECT_EQ(popup_rect.x(), 9); |
| 5440 EXPECT_EQ(popup_rect.y(), 9); | 5440 EXPECT_EQ(popup_rect.y(), 9); |
| 5441 #else | 5441 #else |
| 5442 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); | 5442 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 354); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5467 base::RunLoop run_loop; | 5467 base::RunLoop run_loop; |
| 5468 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 5468 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 5469 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 5469 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
| 5470 run_loop.Run(); | 5470 run_loop.Run(); |
| 5471 } | 5471 } |
| 5472 | 5472 |
| 5473 click_event.button = blink::WebPointerProperties::ButtonLeft; | 5473 click_event.button = blink::WebPointerProperties::ButtonLeft; |
| 5474 click_event.x = 15; | 5474 click_event.x = 15; |
| 5475 click_event.y = 15; | 5475 click_event.y = 15; |
| 5476 click_event.clickCount = 1; | 5476 click_event.clickCount = 1; |
| 5477 rwhv_c_node->ProcessMouseEvent(click_event); | 5477 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5478 | 5478 |
| 5479 click_event.x = 1; | 5479 click_event.x = 1; |
| 5480 click_event.y = 1; | 5480 click_event.y = 1; |
| 5481 rwhv_c_node->ProcessMouseEvent(click_event); | 5481 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); |
| 5482 | 5482 |
| 5483 filter->Wait(); | 5483 filter->Wait(); |
| 5484 | 5484 |
| 5485 popup_rect = filter->last_initial_rect(); | 5485 popup_rect = filter->last_initial_rect(); |
| 5486 | 5486 |
| 5487 #if defined(OS_MACOSX) | 5487 #if defined(OS_MACOSX) |
| 5488 EXPECT_EQ(popup_rect.x(), 9); | 5488 EXPECT_EQ(popup_rect.x(), 9); |
| 5489 EXPECT_EQ(popup_rect.y(), 9); | 5489 EXPECT_EQ(popup_rect.y(), 9); |
| 5490 #else | 5490 #else |
| 5491 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 203); | 5491 EXPECT_EQ(popup_rect.x() - rwhv_root->GetViewBounds().x(), 203); |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6926 | 6926 |
| 6927 EXPECT_EQ( | 6927 EXPECT_EQ( |
| 6928 " Site A ------------ proxies for B\n" | 6928 " Site A ------------ proxies for B\n" |
| 6929 " +--Site B ------- proxies for A\n" | 6929 " +--Site B ------- proxies for A\n" |
| 6930 "Where A = http://a.com/\n" | 6930 "Where A = http://a.com/\n" |
| 6931 " B = http://b.com/", | 6931 " B = http://b.com/", |
| 6932 DepictFrameTree(root)); | 6932 DepictFrameTree(root)); |
| 6933 } | 6933 } |
| 6934 | 6934 |
| 6935 } // namespace content | 6935 } // namespace content |
| OLD | NEW |