Commit 123e7153 authored by Haiyang Pan's avatar Haiyang Pan Committed by Commit Bot

Revert "Rewrite hr-timestamp/input-events.html to a browser test"

This reverts commit 4f6da930.

Reason for revert: InputEventBrowserTest.TouchStartEventTimeStamp is flaky in android pie CQ builder: https://analysis.chromium.org/p/chromium/flake-portal/flakes/occurrences?key=ag9zfmZpbmRpdC1mb3ItbWVyVwsSBUZsYWtlIkxjaHJvbWl1bUBjb250ZW50X2Jyb3dzZXJ0ZXN0c0BJbnB1dEV2ZW50QnJvd3NlclRlc3QuVG91Y2hTdGFydEV2ZW50VGltZVN0YW1wDA

It is flaky in several waterfall builders as well, starting at
https://ci.chromium.org/p/chromium/builders/ci/android-pie-x86-rel/1565
https://ci.chromium.org/p/chromium/builders/ci/android-pie-arm64-rel/5952
https://ci.chromium.org/p/chromium/builders/ci/android-asan/7107

Original change's description:
> Rewrite hr-timestamp/input-events.html to a browser test
> 
> hr-timestamp/input-events.htmlEvent timestamp tests that the received
> events on the page should be equal to the timestamp provided by the
> eventSender's recorded last event. But we should deprecate eventSender in
> the future, and GpuBenchmarking sends events based on the current system
> time, which cannot be equal to the received events' timestamp.
> 
> 
> Bug: 1047176
> Change-Id: I225dec07b1928ae254d61e8a8384ebfc7dab75e6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173421
> Commit-Queue: Lan Wei <lanwei@chromium.org>
> Reviewed-by: David Bokan <bokan@chromium.org>
> Reviewed-by: Majid Valipour <majidvp@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#790868}

TBR=bokan@chromium.org,lanwei@chromium.org,majidvp@chromium.org

Change-Id: Ifd5238546ed74824628a5d126b69a9fa37958ee3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1047176
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314806Reviewed-by: default avatarHaiyang Pan <hypan@google.com>
Commit-Queue: Haiyang Pan <hypan@google.com>
Cr-Commit-Position: refs/heads/master@{#791011}
parent 00e78acc
...@@ -134,7 +134,7 @@ void SyntheticGestureTargetAura::DispatchWebGestureEventToPlatform( ...@@ -134,7 +134,7 @@ void SyntheticGestureTargetAura::DispatchWebGestureEventToPlatform(
: ui::EventMomentumPhase::END; : ui::EventMomentumPhase::END;
ui::ScrollEvent scroll_event(event_type, web_gesture.PositionInWidget(), ui::ScrollEvent scroll_event(event_type, web_gesture.PositionInWidget(),
web_gesture.PositionInWidget(), web_gesture.PositionInWidget(),
web_gesture.TimeStamp(), flags, ui::EventTimeForNow(), flags,
web_gesture.data.fling_start.velocity_x, web_gesture.data.fling_start.velocity_x,
web_gesture.data.fling_start.velocity_y, 0, 0, 2, web_gesture.data.fling_start.velocity_y, 0, 0, 2,
momentum_phase, ui::ScrollEventPhase::kNone); momentum_phase, ui::ScrollEventPhase::kNone);
...@@ -157,8 +157,8 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( ...@@ -157,8 +157,8 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform(
} }
ui::MouseEvent mouse_event(event_type, web_mouse_event.PositionInWidget(), ui::MouseEvent mouse_event(event_type, web_mouse_event.PositionInWidget(),
web_mouse_event.PositionInWidget(), web_mouse_event.PositionInWidget(),
web_mouse_event.TimeStamp(), flags, ui::EventTimeForNow(), flags, changed_button_flags,
changed_button_flags, pointer_details); pointer_details);
aura::Window* window = GetWindow(); aura::Window* window = GetWindow();
mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); mouse_event.ConvertLocationToTarget(window, window->GetRootWindow());
......
...@@ -1036,7 +1036,6 @@ test("content_browsertests") { ...@@ -1036,7 +1036,6 @@ test("content_browsertests") {
"../browser/renderer_host/input/compositor_event_ack_browsertest.cc", "../browser/renderer_host/input/compositor_event_ack_browsertest.cc",
"../browser/renderer_host/input/event_latency_aura_browsertest.cc", "../browser/renderer_host/input/event_latency_aura_browsertest.cc",
"../browser/renderer_host/input/fling_browsertest.cc", "../browser/renderer_host/input/fling_browsertest.cc",
"../browser/renderer_host/input/input_event_browsertest.cc",
"../browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc", "../browser/renderer_host/input/interaction_mq_dynamic_browsertest.cc",
"../browser/renderer_host/input/main_thread_event_queue_browsertest.cc", "../browser/renderer_host/input/main_thread_event_queue_browsertest.cc",
"../browser/renderer_host/input/mouse_latency_browsertest.cc", "../browser/renderer_host/input/mouse_latency_browsertest.cc",
......
...@@ -90,16 +90,6 @@ base::TimeDelta DocumentLoadTiming::MonotonicTimeToPseudoWallTime( ...@@ -90,16 +90,6 @@ base::TimeDelta DocumentLoadTiming::MonotonicTimeToPseudoWallTime(
return monotonic_time + reference_wall_time_ - reference_monotonic_time_; return monotonic_time + reference_wall_time_ - reference_monotonic_time_;
} }
int64_t DocumentLoadTiming::ZeroBasedDocumentTimeToMonotonicTime(
double dom_event_time) const {
if (reference_monotonic_time_.is_null())
return 0;
base::TimeTicks monotonic_time =
reference_monotonic_time_ +
base::TimeDelta::FromMillisecondsD(dom_event_time);
return monotonic_time.since_origin().InMilliseconds();
}
void DocumentLoadTiming::MarkNavigationStart() { void DocumentLoadTiming::MarkNavigationStart() {
// Allow the embedder to override navigationStart before we record it if // Allow the embedder to override navigationStart before we record it if
// they have a more accurate timestamp. // they have a more accurate timestamp.
......
...@@ -50,7 +50,6 @@ class CORE_EXPORT DocumentLoadTiming final { ...@@ -50,7 +50,6 @@ class CORE_EXPORT DocumentLoadTiming final {
base::TimeDelta MonotonicTimeToZeroBasedDocumentTime(base::TimeTicks) const; base::TimeDelta MonotonicTimeToZeroBasedDocumentTime(base::TimeTicks) const;
base::TimeDelta MonotonicTimeToPseudoWallTime(base::TimeTicks) const; base::TimeDelta MonotonicTimeToPseudoWallTime(base::TimeTicks) const;
int64_t ZeroBasedDocumentTimeToMonotonicTime(double dom_event_time) const;
void MarkNavigationStart(); void MarkNavigationStart();
void SetNavigationStart(base::TimeTicks); void SetNavigationStart(base::TimeTicks);
......
...@@ -3317,11 +3317,6 @@ double Internals::monotonicTimeToZeroBasedDocumentTime( ...@@ -3317,11 +3317,6 @@ double Internals::monotonicTimeToZeroBasedDocumentTime(
.InSecondsF(); .InSecondsF();
} }
int64_t Internals::zeroBasedDocumentTimeToMonotonicTime(double dom_event_time) {
return document_->Loader()->GetTiming().ZeroBasedDocumentTimeToMonotonicTime(
dom_event_time);
}
int64_t Internals::currentTimeTicks() { int64_t Internals::currentTimeTicks() {
return base::TimeTicks::Now().since_origin().InMicroseconds(); return base::TimeTicks::Now().since_origin().InMicroseconds();
} }
......
...@@ -543,10 +543,6 @@ class Internals final : public ScriptWrappable { ...@@ -543,10 +543,6 @@ class Internals final : public ScriptWrappable {
// document time in seconds // document time in seconds
double monotonicTimeToZeroBasedDocumentTime(double, ExceptionState&); double monotonicTimeToZeroBasedDocumentTime(double, ExceptionState&);
// Translate an event's DOMHighResTimeStamp in seconds into a monotonic time
// in milliseconds.
int64_t zeroBasedDocumentTimeToMonotonicTime(double dom_event_time);
// Returns the current time ticks (in microseconds). // Returns the current time ticks (in microseconds).
int64_t currentTimeTicks(); int64_t currentTimeTicks();
......
...@@ -366,11 +366,6 @@ ...@@ -366,11 +366,6 @@
boolean setScrollbarVisibilityInScrollableArea(Node node, boolean visible); boolean setScrollbarVisibilityInScrollableArea(Node node, boolean visible);
[RaisesException] double monotonicTimeToZeroBasedDocumentTime(double platformTime); [RaisesException] double monotonicTimeToZeroBasedDocumentTime(double platformTime);
// Translate an event's DOMHighResTimeStamp in seconds into a monotonic time
// in milliseconds.
long long zeroBasedDocumentTimeToMonotonicTime(double domHighResTimeStamp);
long long currentTimeTicks(); long long currentTimeTicks();
DOMString getScrollAnimationState(Node node); DOMString getScrollAnimationState(Node node);
......
<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script type="text/javascript">
'use strict';
const testCases = {
'mousedown': () => eventSender.mouseDown(),
'keydown': () => eventSender.keyDown('x'),
'touchstart': () => {
eventSender.addTouchPoint(1, 1);
eventSender.touchStart();
},
'click': () => eventSender.gestureTap(1, 1),
'wheel': () => eventSender.mouseScrollBy(0, -50),
};
let receivedEvents = [];
for (let eventName in testCases)
createTest(eventName, testCases[eventName]);
function createTest(eventName, dispatchEventFn) {
async_test(function(t) {
document.addEventListener(eventName, t.step_func(function(e) {
receivedEvents.push(eventName);
// Prevent default to ensure contextmenu is not shown which can
// potentially hijack other events.
e.preventDefault();
const platformTimestamp = eventSender.lastEventTimestamp(); // in seconds
const expectedUnclampedTimestamp = internals.monotonicTimeToZeroBasedDocumentTime(platformTimestamp) * 1000; // in milliseconds
// Time clamping logic in Blink can introduce at most 2*100us of
// difference. Use 0.200001 instead of 0.2 to deal with floating
// point comparison issues.
assert_approx_equals(e.timeStamp, expectedUnclampedTimestamp, 0.200001);
t.done();
}));
dispatchEventFn();
t.step_timeout(function() {
assert_unreached("timeout with received events: " + receivedEvents.join(', '));
}, 5000);
}, "Event timestamp should be equal to the timestamp provided by the platform for " + eventName);
}
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment