Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 void ResetEventsReceived() { events_received_.clear(); } 200 void ResetEventsReceived() { events_received_.clear(); }
201 blink::WebInputEvent::Type EventType() const { 201 blink::WebInputEvent::Type EventType() const {
202 DCHECK(EventWasReceived()); 202 DCHECK(EventWasReceived());
203 return events_received_.front(); 203 return events_received_.front();
204 } 204 }
205 const std::vector<blink::WebInputEvent::Type>& events_received() { 205 const std::vector<blink::WebInputEvent::Type>& events_received() {
206 return events_received_; 206 return events_received_;
207 } 207 }
208 208
209 void OnInputEvent(const blink::WebInputEvent& event) override { 209 void OnInputEvent(const blink::WebInputEvent& event) override {
210 events_received_.push_back(event.type); 210 events_received_.push_back(event.type());
211 }; 211 };
212 212
213 private: 213 private:
214 RenderWidgetHost* host_; 214 RenderWidgetHost* host_;
215 std::vector<blink::WebInputEvent::Type> events_received_; 215 std::vector<blink::WebInputEvent::Type> events_received_;
216 216
217 DISALLOW_COPY_AND_ASSIGN(TestInputEventObserver); 217 DISALLOW_COPY_AND_ASSIGN(TestInputEventObserver);
218 }; 218 };
219 219
220 // Helper function that performs a surface hittest. 220 // Helper function that performs a surface hittest.
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1500 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1501 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1501 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1502 1502
1503 // Next send a MouseMove to B frame, which shouldn't affect C or D but 1503 // Next send a MouseMove to B frame, which shouldn't affect C or D but
1504 // A should receive a MouseMove event. 1504 // A should receive a MouseMove event.
1505 mouse_event.x = point_in_b_frame.x(); 1505 mouse_event.x = point_in_b_frame.x();
1506 mouse_event.y = point_in_b_frame.y(); 1506 mouse_event.y = point_in_b_frame.y();
1507 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1507 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1508 ui::LatencyInfo()); 1508 ui::LatencyInfo());
1509 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1509 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1510 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); 1510 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1511 a_frame_monitor.ResetEventReceived(); 1511 a_frame_monitor.ResetEventReceived();
1512 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1512 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1513 b_frame_monitor.ResetEventReceived(); 1513 b_frame_monitor.ResetEventReceived();
1514 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1514 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1515 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1515 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1516 1516
1517 // Next send a MouseMove to D frame, which should have side effects in every 1517 // Next send a MouseMove to D frame, which should have side effects in every
1518 // other RenderWidgetHostView. 1518 // other RenderWidgetHostView.
1519 mouse_event.x = point_in_d_frame.x(); 1519 mouse_event.x = point_in_d_frame.x();
1520 mouse_event.y = point_in_d_frame.y(); 1520 mouse_event.y = point_in_d_frame.y();
1521 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1521 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1522 ui::LatencyInfo()); 1522 ui::LatencyInfo());
1523 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1523 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1524 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); 1524 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1525 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1525 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1526 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave); 1526 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave);
1527 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); 1527 EXPECT_TRUE(c_frame_monitor.EventWasReceived());
1528 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove); 1528 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1529 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); 1529 EXPECT_TRUE(d_frame_monitor.EventWasReceived());
1530 } 1530 }
1531 1531
1532 // Verify that mouse capture works on a RenderWidgetHostView level, so that 1532 // Verify that mouse capture works on a RenderWidgetHostView level, so that
1533 // dragging scroll bars and selecting text continues even when the mouse 1533 // dragging scroll bars and selecting text continues even when the mouse
1534 // cursor crosses over cross-process frame boundaries. 1534 // cursor crosses over cross-process frame boundaries.
1535 #if defined(OS_ANDROID) 1535 #if defined(OS_ANDROID)
1536 // Browser process hit testing is not implemented on Android. 1536 // Browser process hit testing is not implemented on Android.
1537 // https://crbug.com/491334 1537 // https://crbug.com/491334
1538 #define MAYBE_CrossProcessMouseCapture DISABLED_CrossProcessMouseCapture 1538 #define MAYBE_CrossProcessMouseCapture DISABLED_CrossProcessMouseCapture
(...skipping 7380 matching lines...) Expand 10 before | Expand all | Expand 10 after
8919 mouse_event.x = 75; 8919 mouse_event.x = 75;
8920 mouse_event.y = 75; 8920 mouse_event.y = 75;
8921 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo()); 8921 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
8922 8922
8923 EXPECT_TRUE(event_monitor.EventWasReceived()); 8923 EXPECT_TRUE(event_monitor.EventWasReceived());
8924 EXPECT_EQ(mouse_down_coords, 8924 EXPECT_EQ(mouse_down_coords,
8925 gfx::Point(event_monitor.event().x, event_monitor.event().y)); 8925 gfx::Point(event_monitor.event().x, event_monitor.event().y));
8926 } 8926 }
8927 8927
8928 } // namespace content 8928 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698