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

Unified Diff: components/test_runner/event_sender.cc

Issue 1352523002: Use high precision timestamp for Event.timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index bc5977346badfce8574f37855cacb7f5db528f55..457027e58a1c54281c23b341d00eab451be80523 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -404,6 +404,7 @@ class EventSenderBindings : public gin::Wrappable<EventSenderBindings> {
void TouchCancel();
void TouchEnd();
void LeapForward(int milliseconds);
+ double LastEventTimestamp();
void BeginDragWithFiles(const std::vector<std::string>& files);
void AddTouchPoint(double x, double y, gin::Arguments* args);
void MouseDragBegin();
@@ -531,6 +532,7 @@ EventSenderBindings::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetMethod("touchCancel", &EventSenderBindings::TouchCancel)
.SetMethod("touchEnd", &EventSenderBindings::TouchEnd)
.SetMethod("leapForward", &EventSenderBindings::LeapForward)
+ .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp)
.SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles)
.SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint)
.SetMethod("mouseDragBegin", &EventSenderBindings::MouseDragBegin)
@@ -729,6 +731,12 @@ void EventSenderBindings::LeapForward(int milliseconds) {
sender_->LeapForward(milliseconds);
}
+double EventSenderBindings::LastEventTimestamp() {
+ if (sender_)
+ return sender_->last_event_timestamp();
+ return 0;
+}
+
void EventSenderBindings::BeginDragWithFiles(
const std::vector<std::string>& files) {
if (sender_)
@@ -1888,7 +1896,7 @@ void EventSender::MouseLeave() {
click_count_,
0,
&event);
- view_->handleInputEvent(event);
+ HandleInputEventOnViewOrPopup(event);
}
@@ -1946,7 +1954,8 @@ void EventSender::ScheduleAsynchronousKeyDown(const std::string& code_str,
}
double EventSender::GetCurrentEventTimeSec() {
- return (delegate_->GetCurrentTimeInMillisecond() + time_offset_ms_) / 1000.0;
+ return (base::TimeTicks::Now() - base::TimeTicks()).InSeconds() +
+ time_offset_ms_ / 1000.0;
}
void EventSender::DoLeapForward(int milliseconds) {
@@ -2487,6 +2496,8 @@ void EventSender::ReplaySavedEvents() {
}
bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) {
+ last_event_timestamp_ = event.timeStampSeconds;
+
if (WebPagePopup* popup = view_->pagePopup()) {
if (!WebInputEvent::isKeyboardEventType(event.type))
return popup->handleInputEvent(event);
« no previous file with comments | « components/test_runner/event_sender.h ('k') | third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698