OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/test/scoped_feature_list.h" | 7 #include "base/test/scoped_feature_list.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 9 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
10 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 10 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 content::RenderWidgetHostView* child_view = | 1093 content::RenderWidgetHostView* child_view = |
1094 ChildFrameAt(active_web_contents->GetMainFrame(), 0)->GetView(); | 1094 ChildFrameAt(active_web_contents->GetMainFrame(), 0)->GetView(); |
1095 | 1095 |
1096 ContextMenuWaiter menu_waiter(content::NotificationService::AllSources()); | 1096 ContextMenuWaiter menu_waiter(content::NotificationService::AllSources()); |
1097 | 1097 |
1098 // Declaring a lambda to send a right-button mouse event to the embedder | 1098 // Declaring a lambda to send a right-button mouse event to the embedder |
1099 // frame. | 1099 // frame. |
1100 auto send_right_mouse_event = [](content::RenderWidgetHost* host, int x, | 1100 auto send_right_mouse_event = [](content::RenderWidgetHost* host, int x, |
1101 int y, blink::WebInputEvent::Type type) { | 1101 int y, blink::WebInputEvent::Type type) { |
1102 blink::WebMouseEvent event; | 1102 blink::WebMouseEvent event; |
1103 event.x = x; | 1103 event.setPositionInWidget(x, y); |
1104 event.y = y; | |
1105 event.button = blink::WebMouseEvent::Button::Right; | 1104 event.button = blink::WebMouseEvent::Button::Right; |
1106 event.setType(type); | 1105 event.setType(type); |
1107 host->ForwardMouseEvent(event); | 1106 host->ForwardMouseEvent(event); |
1108 }; | 1107 }; |
1109 | 1108 |
1110 send_right_mouse_event(child_view->GetRenderWidgetHost(), 10, 20, | 1109 send_right_mouse_event(child_view->GetRenderWidgetHost(), 10, 20, |
1111 blink::WebInputEvent::MouseDown); | 1110 blink::WebInputEvent::MouseDown); |
1112 send_right_mouse_event(child_view->GetRenderWidgetHost(), 10, 20, | 1111 send_right_mouse_event(child_view->GetRenderWidgetHost(), 10, 20, |
1113 blink::WebInputEvent::MouseUp); | 1112 blink::WebInputEvent::MouseUp); |
1114 menu_waiter.WaitForMenuOpenAndClose(); | 1113 menu_waiter.WaitForMenuOpenAndClose(); |
1115 | 1114 |
1116 gfx::Point point_in_root_window = | 1115 gfx::Point point_in_root_window = |
1117 child_view->TransformPointToRootCoordSpace(gfx::Point(10, 20)); | 1116 child_view->TransformPointToRootCoordSpace(gfx::Point(10, 20)); |
1118 | 1117 |
1119 EXPECT_EQ(point_in_root_window.x(), menu_waiter.params().x); | 1118 EXPECT_EQ(point_in_root_window.x(), menu_waiter.params().x); |
1120 EXPECT_EQ(point_in_root_window.y(), menu_waiter.params().y); | 1119 EXPECT_EQ(point_in_root_window.y(), menu_waiter.params().y); |
1121 } | 1120 } |
1122 | 1121 |
1123 class SitePerProcessAutofillTest : public SitePerProcessInteractiveBrowserTest { | 1122 class SitePerProcessAutofillTest : public SitePerProcessInteractiveBrowserTest { |
1124 public: | 1123 public: |
1125 SitePerProcessAutofillTest() : SitePerProcessInteractiveBrowserTest() {} | 1124 SitePerProcessAutofillTest() : SitePerProcessInteractiveBrowserTest() {} |
1126 ~SitePerProcessAutofillTest() override{}; | 1125 ~SitePerProcessAutofillTest() override {} |
1127 | 1126 |
1128 void SetUpCommandLine(base::CommandLine* command_line) override { | 1127 void SetUpCommandLine(base::CommandLine* command_line) override { |
1129 SitePerProcessInteractiveBrowserTest::SetUpCommandLine(command_line); | 1128 SitePerProcessInteractiveBrowserTest::SetUpCommandLine(command_line); |
1130 // We need to set the feature state before the render process is created, | 1129 // We need to set the feature state before the render process is created, |
1131 // in order for it to inherit the feature state from the browser process. | 1130 // in order for it to inherit the feature state from the browser process. |
1132 // SetUp() runs too early, and SetUpOnMainThread() runs too late. | 1131 // SetUp() runs too early, and SetUpOnMainThread() runs too late. |
1133 scoped_feature_list_.InitAndEnableFeature( | 1132 scoped_feature_list_.InitAndEnableFeature( |
1134 security_state::kHttpFormWarningFeature); | 1133 security_state::kHttpFormWarningFeature); |
1135 } | 1134 } |
1136 | 1135 |
1137 protected: | 1136 protected: |
1138 class TestAutofillClient : public autofill::TestAutofillClient { | 1137 class TestAutofillClient : public autofill::TestAutofillClient { |
1139 public: | 1138 public: |
1140 TestAutofillClient() : popup_shown_(false){}; | 1139 TestAutofillClient() : popup_shown_(false) {} |
1141 ~TestAutofillClient() override {} | 1140 ~TestAutofillClient() override {} |
1142 | 1141 |
1143 void WaitForNextPopup() { | 1142 void WaitForNextPopup() { |
1144 if (popup_shown_) | 1143 if (popup_shown_) |
1145 return; | 1144 return; |
1146 loop_runner_ = new content::MessageLoopRunner(); | 1145 loop_runner_ = new content::MessageLoopRunner(); |
1147 loop_runner_->Run(); | 1146 loop_runner_->Run(); |
1148 } | 1147 } |
1149 | 1148 |
1150 void ShowAutofillPopup( | 1149 void ShowAutofillPopup( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 | 1332 |
1334 // Ideally, the length of the error vector should be 0.0f. But due to | 1333 // Ideally, the length of the error vector should be 0.0f. But due to |
1335 // potential rounding errors, we assume a larger limit (which is slightly | 1334 // potential rounding errors, we assume a larger limit (which is slightly |
1336 // larger than square root of 2). | 1335 // larger than square root of 2). |
1337 EXPECT_LT(error.Length(), 1.4143f) | 1336 EXPECT_LT(error.Length(), 1.4143f) |
1338 << "Origin of bounds from focused node changed event is '" | 1337 << "Origin of bounds from focused node changed event is '" |
1339 << focus_observer.focused_node_bounds_in_screen().ToString() | 1338 << focus_observer.focused_node_bounds_in_screen().ToString() |
1340 << "' but AutofillClient is reporting '" << bounds_origin.ToString() | 1339 << "' but AutofillClient is reporting '" << bounds_origin.ToString() |
1341 << "'"; | 1340 << "'"; |
1342 } | 1341 } |
OLD | NEW |