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

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: Fix nits Created 3 years, 11 months 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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1496 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1497 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1497 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1498 1498
1499 // Next send a MouseMove to B frame, which shouldn't affect C or D but 1499 // Next send a MouseMove to B frame, which shouldn't affect C or D but
1500 // A should receive a MouseMove event. 1500 // A should receive a MouseMove event.
1501 mouse_event.x = point_in_b_frame.x(); 1501 mouse_event.x = point_in_b_frame.x();
1502 mouse_event.y = point_in_b_frame.y(); 1502 mouse_event.y = point_in_b_frame.y();
1503 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1503 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1504 ui::LatencyInfo()); 1504 ui::LatencyInfo());
1505 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1505 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1506 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); 1506 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1507 a_frame_monitor.ResetEventReceived(); 1507 a_frame_monitor.ResetEventReceived();
1508 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1508 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1509 b_frame_monitor.ResetEventReceived(); 1509 b_frame_monitor.ResetEventReceived();
1510 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); 1510 EXPECT_FALSE(c_frame_monitor.EventWasReceived());
1511 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); 1511 EXPECT_FALSE(d_frame_monitor.EventWasReceived());
1512 1512
1513 // Next send a MouseMove to D frame, which should have side effects in every 1513 // Next send a MouseMove to D frame, which should have side effects in every
1514 // other RenderWidgetHostView. 1514 // other RenderWidgetHostView.
1515 mouse_event.x = point_in_d_frame.x(); 1515 mouse_event.x = point_in_d_frame.x();
1516 mouse_event.y = point_in_d_frame.y(); 1516 mouse_event.y = point_in_d_frame.y();
1517 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, 1517 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event,
1518 ui::LatencyInfo()); 1518 ui::LatencyInfo());
1519 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); 1519 EXPECT_TRUE(a_frame_monitor.EventWasReceived());
1520 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); 1520 EXPECT_EQ(a_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1521 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); 1521 EXPECT_TRUE(b_frame_monitor.EventWasReceived());
1522 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave); 1522 EXPECT_EQ(b_frame_monitor.event().type(), blink::WebInputEvent::MouseLeave);
1523 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); 1523 EXPECT_TRUE(c_frame_monitor.EventWasReceived());
1524 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove); 1524 EXPECT_EQ(c_frame_monitor.event().type(), blink::WebInputEvent::MouseMove);
1525 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); 1525 EXPECT_TRUE(d_frame_monitor.EventWasReceived());
1526 } 1526 }
1527 1527
1528 // Verify that mouse capture works on a RenderWidgetHostView level, so that 1528 // Verify that mouse capture works on a RenderWidgetHostView level, so that
1529 // dragging scroll bars and selecting text continues even when the mouse 1529 // dragging scroll bars and selecting text continues even when the mouse
1530 // cursor crosses over cross-process frame boundaries. 1530 // cursor crosses over cross-process frame boundaries.
1531 #if defined(OS_ANDROID) 1531 #if defined(OS_ANDROID)
1532 // Browser process hit testing is not implemented on Android. 1532 // Browser process hit testing is not implemented on Android.
1533 // https://crbug.com/491334 1533 // https://crbug.com/491334
1534 #define MAYBE_CrossProcessMouseCapture DISABLED_CrossProcessMouseCapture 1534 #define MAYBE_CrossProcessMouseCapture DISABLED_CrossProcessMouseCapture
(...skipping 7456 matching lines...) Expand 10 before | Expand all | Expand 10 after
8991 rfh->OnSwappedOut(); 8991 rfh->OnSwappedOut();
8992 8992
8993 // Wait for the new a.com navigation to finish. 8993 // Wait for the new a.com navigation to finish.
8994 back_observer.Wait(); 8994 back_observer.Wait();
8995 8995
8996 // The RVH for a.com should've been reused, and it should be active. 8996 // The RVH for a.com should've been reused, and it should be active.
8997 EXPECT_TRUE(rvh->is_active()); 8997 EXPECT_TRUE(rvh->is_active());
8998 } 8998 }
8999 8999
9000 } // namespace content 9000 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/ui_events_helper.cc ('k') | content/common/content_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698