Post EventTimingMatchPresentationIndex Launch Cleanup
Since the EventTimingMatchPresentationIndex finch experiment has
diverged event timing into two code paths and it's now launched,
we remove those code paths that are no longer reachable and clean
up those obsolete use counters & histograms.
- feature flags removed since launched:
* EventTimingMatchPresentationIndex
- feature flags removed since abandoned:
* EventTimingReportAllEarlyEntriesOnPaintedPresentation
- histograms removed:
* PageLoad.Internal.EventTiming.PendingPresentationPromiseCount
- use counters removed:
* EventTimingPresentationPromiseResolvedAfterReport
* EventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved
OBSOLETE_HISTOGRAM[PageLoad.Internal.EventTiming.PendingPresentationPromiseCount]=Remove prior launch analysis after EventTimingMatchPresentationIndex is launched.
Bug: 1425540
Change-Id: I2f1dd425ba0808fb621cc0c104a02d62258dce78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5225107
Commit-Queue: Aoyuan Zuo <zuoaoyuan@chromium.org>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Reviewed-by: Michal Mocny <mmocny@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1251478}
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
index ee63bec..f6cf0a1 100644
--- a/third_party/blink/common/features.cc
+++ b/third_party/blink/common/features.cc
@@ -749,17 +749,6 @@
#endif
);
-// Enables reporting Event Timing with matching presentation promise index only.
-BASE_FEATURE(kEventTimingMatchPresentationIndex,
- "EventTimingMatchPresentationIndex",
- base::FEATURE_ENABLED_BY_DEFAULT);
-
-// Enables reporting Event Timing entries with a smaller presentation index on
-// resolved painted presentation.
-BASE_FEATURE(kEventTimingReportAllEarlyEntriesOnPaintedPresentation,
- "EventTimingReportAllEarlyEntriesOnPaintedPresentation",
- base::FEATURE_DISABLED_BY_DEFAULT);
-
// Enables unload handler deprecation via Permissions-Policy.
// https://crbug.com/1324111
BASE_FEATURE(kDeprecateUnload,
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h
index a18ecaa0..1618a41 100644
--- a/third_party/blink/public/common/features.h
+++ b/third_party/blink/public/common/features.h
@@ -401,7 +401,6 @@
// layer tree frame sink.
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kEstablishGpuChannelAsync);
-BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kEventTimingMatchPresentationIndex);
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kDeprecateUnload);
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kDeprecateUnloadByAllowList);
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kDeprecateUnloadByUserAndOrigin);
@@ -410,10 +409,6 @@
BLINK_COMMON_EXPORT extern const base::FeatureParam<int> kDeprecateUnloadBucket;
BLINK_COMMON_EXPORT extern const base::FeatureParam<std::string>
kDeprecateUnloadAllowlist;
-// This feature (EventTimingReportAllEarlyEntriesOnPaintedPresentation) is
-// having an effect only when EventTimingMatchPresentationIndex is turned on.
-BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(
- kEventTimingReportAllEarlyEntriesOnPaintedPresentation);
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kExcludeLowEntropyImagesFromLCP);
BLINK_COMMON_EXPORT extern const base::FeatureParam<double>
diff --git a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
index e1af1bfd..11d26a5 100644
--- a/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
+++ b/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
@@ -3908,7 +3908,7 @@
kCSSValueAppearanceSliderthumbHorizontal = 4557,
kCSSValueAppearanceSliderthumbVertical = 4558,
kServiceWorkerBypassFetchHandlerForAllWithRaceNetworkRequestByOriginTrial = 4559,
- kEventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved = 4560,
+ kOBSOLETE_EventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved = 4560,
kLinkRelPreloadAsFont = 4561,
kCrossWindowAccessToBrowserGeneratedDocument = 4562,
kSpeculationRulesNoVarySearchHint = 4563,
@@ -3947,7 +3947,7 @@
kOBSOLETE_TextWrapPretty = 4594,
kOBSOLETE_TextWrapPrettyFail = 4595,
kContainerQueryEvalUnknown = 4596,
- kEventTimingPresentationPromiseResolvedAfterReport = 4597,
+ kOBSOLETE_EventTimingPresentationPromiseResolvedAfterReport = 4597,
kGetCoalescedEventsInInsecureContext = 4598,
kCSPEESameOriginBlanketEnforcement = 4599,
// The items above roughly this point are available in the M116 branch.
diff --git a/third_party/blink/renderer/core/timing/window_performance.cc b/third_party/blink/renderer/core/timing/window_performance.cc
index 4fa697c9..e8b3e78 100644
--- a/third_party/blink/renderer/core/timing/window_performance.cc
+++ b/third_party/blink/renderer/core/timing/window_performance.cc
@@ -31,7 +31,6 @@
#include "third_party/blink/renderer/core/timing/window_performance.h"
-#include "base/metrics/histogram_macros.h"
#include "base/trace_event/common/trace_event_common.h"
#include "base/trace_event/trace_event.h"
#include "services/metrics/public/cpp/ukm_builders.h"
@@ -94,9 +93,6 @@
namespace {
-const char kEventTimingPendingPresentationPromiseCount[] =
- "PageLoad.Internal.EventTiming.PendingPresentationPromiseCount";
-
AtomicString GetFrameAttribute(HTMLFrameOwnerElement* frame_owner,
const QualifiedName& attr_name) {
AtomicString attr_value;
@@ -417,39 +413,13 @@
}
eventCounts()->Add(event_type);
- if (base::FeatureList::IsEnabled(
- features::kEventTimingMatchPresentationIndex)) {
- if (need_new_promise_for_event_presentation_time_) {
- DomWindow()->GetFrame()->GetChromeClient().NotifyPresentationTime(
- *DomWindow()->GetFrame(),
- CrossThreadBindOnce(&WindowPerformance::OnPresentationPromiseResolved,
- WrapCrossThreadWeakPersistent(this),
- ++event_presentation_promise_count_));
- need_new_promise_for_event_presentation_time_ = false;
- }
- } else {
- bool should_queue_presentation_promise = false;
- // If there are no pending presentation promises, we should queue one. This
- // ensures that |event_timings_| are processed even if the Blink lifecycle
- // does not occur due to no DOM updates.
- if (pending_presentation_promise_count_ == 0u) {
- should_queue_presentation_promise = true;
- } else {
- // There are pending presentation promises, so only queue one if the event
- // corresponds to a later frame than the one of the latest queued
- // presentation promise.
- should_queue_presentation_promise =
- frame_index_ > last_registered_frame_index_;
- }
- if (should_queue_presentation_promise) {
- DomWindow()->GetFrame()->GetChromeClient().NotifyPresentationTime(
- *DomWindow()->GetFrame(),
- CrossThreadBindOnce(
- &WindowPerformance::ReportEventTimingsWithFrameIndex,
- WrapCrossThreadWeakPersistent(this), frame_index_));
- last_registered_frame_index_ = frame_index_;
- ++pending_presentation_promise_count_;
- }
+ if (need_new_promise_for_event_presentation_time_) {
+ DomWindow()->GetFrame()->GetChromeClient().NotifyPresentationTime(
+ *DomWindow()->GetFrame(),
+ CrossThreadBindOnce(&WindowPerformance::OnPresentationPromiseResolved,
+ WrapCrossThreadWeakPersistent(this),
+ ++event_presentation_promise_count_));
+ need_new_promise_for_event_presentation_time_ = false;
}
PerformanceEventTiming* entry = PerformanceEventTiming::Create(
@@ -469,7 +439,7 @@
}
// Add |entry| to the end of the queue along with the presentation promise
// index in order to match with corresponding presentation feedback later.
- events_data_.push_back(EventData::Create(entry, frame_index_,
+ events_data_.push_back(EventData::Create(entry,
event_presentation_promise_count_,
start_time, key_code, pointer_id));
SetCurrentEventTimingEvent(nullptr);
@@ -487,42 +457,6 @@
if (!DomWindow() || !DomWindow()->document()) {
return;
}
- if (events_data_.empty()) {
- // Counts when a presentation promise got resolved after its related entries
- // being reported.
- UseCounter::Count(
- GetExecutionContext(),
- WebFeature::kEventTimingPresentationPromiseResolvedAfterReport);
-
- return;
- }
-
- const bool is_painted_presentation_promise =
- presentation_index < event_presentation_promise_count_ ||
- need_new_promise_for_event_presentation_time_;
- if (is_painted_presentation_promise &&
- events_data_.front()->GetPresentationIndex() < presentation_index) {
- // Counts when a painted presentation promise got resolved but an earlier
- // one is still pending.
- UseCounter::Count(
- GetExecutionContext(),
- WebFeature::
- kEventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved);
-
- if (last_resolved_painted_event_presentation_promise_index_ <
- presentation_index) {
- last_resolved_painted_event_presentation_promise_index_ =
- presentation_index;
- }
- } else if (is_painted_presentation_promise &&
- events_data_.front()->GetPresentationIndex() >
- presentation_index) {
- // Counts when a presentation promise got resolved after its related entries
- // being reported.
- UseCounter::Count(
- GetExecutionContext(),
- WebFeature::kEventTimingPresentationPromiseResolvedAfterReport);
- }
// If the resolved presentation promise is the latest one we registered, then
// events arrive after will need a new presentation promise to provide
@@ -540,43 +474,22 @@
DOMHighResTimeStamp end_time =
MonotonicTimeToDOMHighResTimeStamp(presentation_timestamp);
responsiveness_metrics_->FlushExpiredKeydown(end_time);
-
- // Record histogram for pending presentation promise count.
- UMA_HISTOGRAM_COUNTS_1000(
- kEventTimingPendingPresentationPromiseCount,
- events_data_.empty()
- ? 0
- : static_cast<int>(event_presentation_promise_count_ -
- events_data_.front()->GetPresentationIndex() + 1));
}
void WindowPerformance::ReportEventTimings() {
CHECK(DomWindow() && DomWindow()->document());
InteractiveDetector* interactive_detector =
InteractiveDetector::From(*(DomWindow()->document()));
- bool report_all_early_entries = base::FeatureList::IsEnabled(
- features::kEventTimingReportAllEarlyEntriesOnPaintedPresentation);
CHECK(!events_data_.empty());
for (uint64_t presentation_index_to_report =
events_data_.front()->GetPresentationIndex();
- ; ++presentation_index_to_report) {
- const bool is_resolved_promise =
- pending_event_presentation_time_map_.Contains(
- presentation_index_to_report);
- const bool is_early_entry =
- presentation_index_to_report <
- last_resolved_painted_event_presentation_promise_index_;
- if (!is_resolved_promise && !(is_early_entry && report_all_early_entries)) {
- return;
- }
-
- base::TimeTicks presentation_timestamp = base::TimeTicks();
- if (is_resolved_promise) {
- presentation_timestamp =
- pending_event_presentation_time_map_.at(presentation_index_to_report);
- pending_event_presentation_time_map_.erase(presentation_index_to_report);
- }
+ pending_event_presentation_time_map_.Contains(
+ presentation_index_to_report);
+ ++presentation_index_to_report) {
+ base::TimeTicks presentation_timestamp =
+ pending_event_presentation_time_map_.at(presentation_index_to_report);
+ pending_event_presentation_time_map_.erase(presentation_index_to_report);
while (!events_data_.empty() &&
events_data_.front()->GetPresentationIndex() ==
@@ -606,11 +519,10 @@
WebFeature::kEventTimingArtificialPointerupOrClick);
}
- // The page visibility was changed, or the entry's related presentation
- // promise didn't resolve, or this is an artificial event. We fallback entry's
- // end time to its processingEnd (as if there was no next paint needed).
+ // The page visibility was changed, or this is an artificial event. We
+ // fallback entry's end time to its processingEnd (as if there was no next
+ // paint needed).
const bool fallback_end_time_to_processing_end =
- presentation_timestamp == base::TimeTicks() ||
(last_visibility_change_timestamp_ > event_timestamp &&
last_visibility_change_timestamp_ < presentation_timestamp)
#if BUILDFLAG(IS_MAC)
@@ -689,40 +601,6 @@
}
}
-void WindowPerformance::ReportEventTimingsWithFrameIndex(
- uint64_t frame_index,
- base::TimeTicks presentation_timestamp) {
- DCHECK(pending_presentation_promise_count_);
- --pending_presentation_promise_count_;
- if (events_data_.empty()) {
- return;
- }
-
- if (!DomWindow() || !DomWindow()->document()) {
- return;
- }
- InteractiveDetector* interactive_detector =
- InteractiveDetector::From(*(DomWindow()->document()));
- DOMHighResTimeStamp end_time =
- MonotonicTimeToDOMHighResTimeStamp(presentation_timestamp);
- while (!events_data_.empty()) {
- auto event_data = events_data_.front();
- uint64_t entry_frame_index = event_data->GetFrameIndex();
- // If the entry was queued at a frame index that is larger than
- // |frame_index|, then we've reached the end of the entries that we can
- // process during this callback.
- if (entry_frame_index > frame_index) {
- break;
- }
-
- ReportEvent(interactive_detector, event_data, presentation_timestamp);
- events_data_.pop_front();
- }
-
- // Use |end_time| as a proxy for the current time to flush expired keydowns.
- responsiveness_metrics_->FlushExpiredKeydown(end_time);
-}
-
void WindowPerformance::NotifyAndAddEventTimingBuffer(
PerformanceEventTiming* entry) {
if (HasObserverFor(PerformanceEntry::kEvent)) {
@@ -931,8 +809,6 @@
}
void WindowPerformance::OnPaintFinished() {
- ++frame_index_;
-
// The event processed after a paint will have different presentation time
// than previous ones, so we need to register a new presentation promise for
// it.
diff --git a/third_party/blink/renderer/core/timing/window_performance.h b/third_party/blink/renderer/core/timing/window_performance.h
index 7a1d357..8609a7d 100644
--- a/third_party/blink/renderer/core/timing/window_performance.h
+++ b/third_party/blink/renderer/core/timing/window_performance.h
@@ -65,34 +65,30 @@
class EventData : public GarbageCollected<EventData> {
public:
EventData(PerformanceEventTiming* event_timing,
- uint64_t frame,
uint64_t presentation_index,
base::TimeTicks event_timestamp,
absl::optional<int> key_code,
absl::optional<PointerId> pointer_id)
: event_timing_(event_timing),
- frame_(frame),
presentation_index_(presentation_index),
event_timestamp_(event_timestamp),
key_code_(key_code),
pointer_id_(pointer_id) {}
static EventData* Create(PerformanceEventTiming* event_timing,
- uint64_t frame,
uint64_t presentation_index,
base::TimeTicks event_timestamp,
absl::optional<int> key_code,
absl::optional<PointerId> pointer_id) {
- return MakeGarbageCollected<EventData>(
- event_timing, frame, presentation_index, event_timestamp, key_code,
- pointer_id);
+ return MakeGarbageCollected<EventData>(event_timing, presentation_index,
+ event_timestamp, key_code,
+ pointer_id);
}
~EventData() = default;
void Trace(Visitor*) const;
PerformanceEventTiming* GetEventTiming() const {
return event_timing_.Get();
}
- uint64_t GetFrameIndex() const { return frame_; }
uint64_t GetPresentationIndex() const { return presentation_index_; }
base::TimeTicks GetEventTimestamp() const { return event_timestamp_; }
absl::optional<int> GetKeyCode() const { return key_code_; }
@@ -103,8 +99,6 @@
// yet: the event dispatch has been completed but the presentation promise
// used to determine |duration| has not yet been resolved.
Member<PerformanceEventTiming> event_timing_;
- // Frame index in which the entry in |event_timing_| were added.
- uint64_t frame_;
// Presentation promise index in which the entry in |event_timing_| was
// added.
uint64_t presentation_index_;
@@ -211,11 +205,6 @@
// Report buffered events with presentation time following their registered
// order; stop as soon as seeing an event with pending presentation promise.
void ReportEventTimings();
- // Method called once presentation promise for a frame is resolved. It will
- // add all event timings that have not been added since the last presentation
- // promise.
- void ReportEventTimingsWithFrameIndex(uint64_t frame_index,
- base::TimeTicks presentation_timestamp);
void ReportEvent(InteractiveDetector* interactive_detector,
Member<EventData> event_data,
base::TimeTicks presentation_timestamp);
@@ -238,31 +227,18 @@
// The last time the page visibility was changed.
base::TimeTicks last_visibility_change_timestamp_;
- // Counter of the current frame index, based on calls to OnPaintFinished().
- uint64_t frame_index_ = 1;
- // Monotonically increasing value with the last frame index on which a
- // presentation promise was queued;
- uint64_t last_registered_frame_index_ = 0;
- // Number of pending presentation promises.
- uint16_t pending_presentation_promise_count_ = 0;
-
// Controls if we register a new presentation promise upon events arrival.
bool need_new_promise_for_event_presentation_time_ = true;
// Counts the total number of presentation promises we've registered for
// events' presentation feedback since the beginning.
uint64_t event_presentation_promise_count_ = 0;
- // Record presentation promise index when a painted one got resolved. We
- // believe painted presentation promise should always resolve follow their
- // creation order. Thus, any unresolved promise with a smaller index should be
- // reported without waiting for their callback.
- uint64_t last_resolved_painted_event_presentation_promise_index_ = 0;
// Map from presentation promise index to pending event presentation
// timestamp. It gets emptied consistently once corresponding entries are
// reported.
HashMap<uint64_t, base::TimeTicks> pending_event_presentation_time_map_;
// Store all event timing and latency related data, including
- // PerformanceEventTiming, frame_index, presentation_index, keycode and
- // pointerId. We use the data to calculate events latencies.
+ // PerformanceEventTiming, presentation_index, keycode and pointerId.
+ // We use the data to calculate events latencies.
HeapDeque<Member<EventData>> events_data_;
Member<PerformanceEventTiming> first_pointer_down_event_timing_;
Member<EventCounts> event_counts_;
diff --git a/third_party/blink/renderer/core/timing/window_performance_test.cc b/third_party/blink/renderer/core/timing/window_performance_test.cc
index 69bf431..3e8acb0 100644
--- a/third_party/blink/renderer/core/timing/window_performance_test.cc
+++ b/third_party/blink/renderer/core/timing/window_performance_test.cc
@@ -7,7 +7,6 @@
#include "base/numerics/safe_conversions.h"
#include "base/test/metrics/histogram_tester.h"
-#include "base/test/scoped_feature_list.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/test/trace_event_analyzer.h"
#include "base/time/time.h"
@@ -58,17 +57,9 @@
} // namespace
-class WindowPerformanceTest : public testing::Test,
- public ::testing::WithParamInterface<bool> {
+class WindowPerformanceTest : public testing::Test {
protected:
void SetUp() override {
- if (GetParam()) {
- features_.InitWithFeatures(
- {blink::features::kEventTimingMatchPresentationIndex,
- blink::features::
- kEventTimingReportAllEarlyEntriesOnPaintedPresentation},
- {});
- }
test_task_runner_ = base::MakeRefCounted<base::TestMockTimeTaskRunner>();
ResetPerformance();
}
@@ -84,11 +75,8 @@
}
void SimulatePaint() { performance_->OnPaintFinished(); }
- // Currently only work with features::kEventTimingMatchPresentationIndex.
void SimulateResolvePresentationPromise(uint64_t presentation_index,
base::TimeTicks timestamp) {
- CHECK(base::FeatureList::IsEnabled(
- features::kEventTimingMatchPresentationIndex));
performance_->OnPresentationPromiseResolved(presentation_index, timestamp);
}
@@ -97,15 +85,9 @@
// SimulateResolvePresentationPromise() separately instead and perform actions
// in between as needed.
void SimulatePaintAndResolvePresentationPromise(base::TimeTicks timestamp) {
- if (base::FeatureList::IsEnabled(
- features::kEventTimingMatchPresentationIndex)) {
- SimulatePaint();
- SimulateResolvePresentationPromise(
- performance_->event_presentation_promise_count_, timestamp);
- } else {
- performance_->ReportEventTimingsWithFrameIndex(
- performance_->frame_index_++, timestamp);
- }
+ SimulatePaint();
+ SimulateResolvePresentationPromise(
+ performance_->event_presentation_promise_count_, timestamp);
}
void SimulateInteractionId(
@@ -204,10 +186,9 @@
scoped_refptr<base::TestMockTimeTaskRunner> test_task_runner_;
ScopedFakeUkmRecorder scoped_fake_ukm_recorder_;
base::HistogramTester histogram_tester_;
- base::test::ScopedFeatureList features_;
};
-TEST_P(WindowPerformanceTest, SanitizedLongTaskName) {
+TEST_F(WindowPerformanceTest, SanitizedLongTaskName) {
// Unable to attribute, when no execution contents are available.
EXPECT_EQ("unknown", SanitizedAttribution(nullptr, false, GetFrame()));
@@ -219,7 +200,7 @@
SanitizedAttribution(GetWindow(), true, GetFrame()));
}
-TEST_P(WindowPerformanceTest, SanitizedLongTaskName_CrossOrigin) {
+TEST_F(WindowPerformanceTest, SanitizedLongTaskName_CrossOrigin) {
// Create another dummy page holder and pretend it is an iframe.
DummyPageHolder another_page(gfx::Size(400, 300));
another_page.GetDocument().SetURL(KURL("https://iframed.com/bar"));
@@ -236,7 +217,7 @@
// https://crbug.com/706798: Checks that after navigation that have replaced the
// window object, calls to not garbage collected yet WindowPerformance belonging
// to the old window do not cause a crash.
-TEST_P(WindowPerformanceTest, NavigateAway) {
+TEST_F(WindowPerformanceTest, NavigateAway) {
AddLongTaskObserver();
// Simulate navigation commit.
@@ -291,7 +272,7 @@
// Make sure the output entries with the same timestamps follow the insertion
// order. (http://crbug.com/767560)
-TEST_P(WindowPerformanceTest, EnsureEntryListOrder) {
+TEST_F(WindowPerformanceTest, EnsureEntryListOrder) {
// Need to have an active V8 context for ScriptValues to operate.
v8::HandleScope handle_scope(GetScriptState()->GetIsolate());
v8::Local<v8::Context> context = GetScriptState()->GetContext();
@@ -324,7 +305,7 @@
}
}
-TEST_P(WindowPerformanceTest, EventTimingEntryBuffering) {
+TEST_F(WindowPerformanceTest, EventTimingEntryBuffering) {
EXPECT_TRUE(page_holder_->GetFrame().Loader().GetDocumentLoader());
base::TimeTicks start_time = GetTimeOrigin() + base::Seconds(1.1);
@@ -332,8 +313,8 @@
base::TimeTicks processing_end = GetTimeOrigin() + base::Seconds(3.8);
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- base::TimeTicks swap_time = GetTimeOrigin() + base::Seconds(6.0);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ base::TimeTicks presentation_time = GetTimeOrigin() + base::Seconds(6.0);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(1u, performance_
->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
@@ -345,7 +326,7 @@
.MarkLoadEventStart();
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(2u, performance_
->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
@@ -355,13 +336,13 @@
EXPECT_FALSE(page_holder_->GetFrame().Loader().GetDocumentLoader());
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(3u, performance_
->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
}
-TEST_P(WindowPerformanceTest, Expose100MsEvents) {
+TEST_F(WindowPerformanceTest, Expose100MsEvents) {
base::TimeTicks start_time = GetTimeOrigin() + base::Seconds(1);
base::TimeTicks processing_start = start_time + base::Milliseconds(10);
base::TimeTicks processing_end = processing_start + base::Milliseconds(10);
@@ -372,10 +353,10 @@
RegisterPointerEvent(event_type_names::kClick, start_time2, processing_start,
processing_end, 4);
- // The swap time is 100.1 ms after |start_time| but only 99.9 ms after
+ // The presentation time is 100.1 ms after |start_time| but only 99.9 ms after
// |start_time2|.
- base::TimeTicks swap_time = start_time + base::Microseconds(100100);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ base::TimeTicks presentation_time = start_time + base::Microseconds(100100);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
// Only the longer event should have been reported.
const auto& entries =
performance_->getBufferedEntriesByType(performance_entry_names::kEvent);
@@ -383,40 +364,42 @@
EXPECT_EQ(event_type_names::kMousedown, entries.at(0)->name());
}
-TEST_P(WindowPerformanceTest, EventTimingDuration) {
+TEST_F(WindowPerformanceTest, EventTimingDuration) {
base::TimeTicks start_time = GetTimeOrigin() + base::Milliseconds(1000);
base::TimeTicks processing_start = GetTimeOrigin() + base::Milliseconds(1001);
base::TimeTicks processing_end = GetTimeOrigin() + base::Milliseconds(1002);
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- base::TimeTicks short_swap_time = GetTimeOrigin() + base::Milliseconds(1003);
- SimulatePaintAndResolvePresentationPromise(short_swap_time);
+ base::TimeTicks short_presentation_time =
+ GetTimeOrigin() + base::Milliseconds(1003);
+ SimulatePaintAndResolvePresentationPromise(short_presentation_time);
EXPECT_EQ(0u, performance_
->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- base::TimeTicks long_swap_time = GetTimeOrigin() + base::Milliseconds(2000);
- SimulatePaintAndResolvePresentationPromise(long_swap_time);
+ base::TimeTicks long_presentation_time =
+ GetTimeOrigin() + base::Milliseconds(2000);
+ SimulatePaintAndResolvePresentationPromise(long_presentation_time);
EXPECT_EQ(1u, performance_
->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(short_swap_time);
+ SimulatePaintAndResolvePresentationPromise(short_presentation_time);
RegisterPointerEvent(event_type_names::kClick, start_time, processing_start,
processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(long_swap_time);
+ SimulatePaintAndResolvePresentationPromise(long_presentation_time);
EXPECT_EQ(2u, performance_
->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
}
-// Test the case where multiple events are registered and then their swap
-// promise is resolved.
-TEST_P(WindowPerformanceTest, MultipleEventsThenSwap) {
+// Test the case where multiple events are registered and then their
+// presentation promise is resolved.
+TEST_F(WindowPerformanceTest, MultipleEventsThenPresent) {
size_t num_events = 10;
for (size_t i = 0; i < num_events; ++i) {
base::TimeTicks start_time = GetTimeOrigin() + base::Seconds(i);
@@ -429,8 +412,9 @@
performance_->getBufferedEntriesByType(performance_entry_names::kEvent)
.size());
}
- base::TimeTicks swap_time = GetTimeOrigin() + base::Seconds(num_events);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ base::TimeTicks presentation_time =
+ GetTimeOrigin() + base::Seconds(num_events);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(
num_events,
performance_->getBufferedEntriesByType(performance_entry_names::kEvent)
@@ -438,7 +422,7 @@
}
// Test for existence of 'first-input' given different types of first events.
-TEST_P(WindowPerformanceTest, FirstInput) {
+TEST_F(WindowPerformanceTest, FirstInput) {
struct {
AtomicString event_type;
bool should_report;
@@ -472,7 +456,7 @@
// Test that the 'first-input' is populated after some irrelevant events are
// ignored.
-TEST_P(WindowPerformanceTest, FirstInputAfterIgnored) {
+TEST_F(WindowPerformanceTest, FirstInputAfterIgnored) {
AtomicString several_events[] = {event_type_names::kMouseover,
event_type_names::kMousedown,
event_type_names::kPointerup};
@@ -493,20 +477,20 @@
}
// Test that pointerdown followed by pointerup works as a 'firstInput'.
-TEST_P(WindowPerformanceTest, FirstPointerUp) {
+TEST_F(WindowPerformanceTest, FirstPointerUp) {
base::TimeTicks start_time = GetTimeStamp(0);
base::TimeTicks processing_start = GetTimeStamp(1);
base::TimeTicks processing_end = GetTimeStamp(2);
- base::TimeTicks swap_time = GetTimeStamp(3);
+ base::TimeTicks presentation_time = GetTimeStamp(3);
RegisterPointerEvent(event_type_names::kPointerdown, start_time,
processing_start, processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(0u,
performance_->getEntriesByType(performance_entry_names::kFirstInput)
.size());
RegisterPointerEvent(event_type_names::kPointerup, start_time,
processing_start, processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(1u,
performance_->getEntriesByType(performance_entry_names::kFirstInput)
.size());
@@ -519,14 +503,14 @@
// When the pointerdown is optimized out, the mousedown works as a
// 'first-input'.
-TEST_P(WindowPerformanceTest, PointerdownOptimizedOut) {
+TEST_F(WindowPerformanceTest, PointerdownOptimizedOut) {
base::TimeTicks start_time = GetTimeStamp(0);
base::TimeTicks processing_start = GetTimeStamp(1);
base::TimeTicks processing_end = GetTimeStamp(2);
- base::TimeTicks swap_time = GetTimeStamp(3);
+ base::TimeTicks presentation_time = GetTimeStamp(3);
RegisterPointerEvent(event_type_names::kMousedown, start_time,
processing_start, processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(1u,
performance_->getEntriesByType(performance_entry_names::kFirstInput)
.size());
@@ -539,26 +523,26 @@
// Test that pointerdown followed by mousedown, pointerup works as a
// 'first-input'.
-TEST_P(WindowPerformanceTest, PointerdownOnDesktop) {
+TEST_F(WindowPerformanceTest, PointerdownOnDesktop) {
base::TimeTicks start_time = GetTimeStamp(0);
base::TimeTicks processing_start = GetTimeStamp(1);
base::TimeTicks processing_end = GetTimeStamp(2);
- base::TimeTicks swap_time = GetTimeStamp(3);
+ base::TimeTicks presentation_time = GetTimeStamp(3);
RegisterPointerEvent(event_type_names::kPointerdown, start_time,
processing_start, processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(0u,
performance_->getEntriesByType(performance_entry_names::kFirstInput)
.size());
RegisterPointerEvent(event_type_names::kMousedown, start_time,
processing_start, processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(0u,
performance_->getEntriesByType(performance_entry_names::kFirstInput)
.size());
RegisterPointerEvent(event_type_names::kPointerup, start_time,
processing_start, processing_end, 4);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
EXPECT_EQ(1u,
performance_->getEntriesByType(performance_entry_names::kFirstInput)
.size());
@@ -569,25 +553,25 @@
.size());
}
-TEST_P(WindowPerformanceTest, OneKeyboardInteraction) {
+TEST_F(WindowPerformanceTest, OneKeyboardInteraction) {
base::TimeTicks keydown_timestamp = GetTimeStamp(0);
// Keydown
base::TimeTicks processing_start_keydown = GetTimeStamp(1);
base::TimeTicks processing_end_keydown = GetTimeStamp(2);
- base::TimeTicks swap_time_keydown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(5);
int key_code = 2;
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Keyup
base::TimeTicks keyup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_keyup = GetTimeStamp(5);
base::TimeTicks processing_end_keyup = GetTimeStamp(6);
- base::TimeTicks swap_time_keyup = GetTimeStamp(10);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(10);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup, key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -619,48 +603,48 @@
"Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 0);
}
-TEST_P(WindowPerformanceTest, HoldingDownAKey) {
+TEST_F(WindowPerformanceTest, HoldingDownAKey) {
auto entries = GetUkmRecorder()->GetEntriesByName(
ukm::builders::Responsiveness_UserInteraction::kEntryName);
EXPECT_EQ(0u, entries.size());
base::TimeTicks keydown_timestamp = GetTimeOrigin();
base::TimeTicks processing_start_keydown = GetTimeStamp(1);
base::TimeTicks processing_end_keydown = GetTimeStamp(2);
- base::TimeTicks swap_time_keydown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(5);
int key_code = 2;
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Second Keydown
keydown_timestamp = GetTimeStamp(1);
processing_start_keydown = GetTimeStamp(2);
processing_end_keydown = GetTimeStamp(3);
- swap_time_keydown = GetTimeStamp(7);
+ presentation_time_keydown = GetTimeStamp(7);
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Third Keydown
keydown_timestamp = GetTimeStamp(2);
processing_start_keydown = GetTimeStamp(3);
processing_end_keydown = GetTimeStamp(5);
- swap_time_keydown = GetTimeStamp(9);
+ presentation_time_keydown = GetTimeStamp(9);
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Keyup
base::TimeTicks keyup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_keyup = GetTimeStamp(5);
base::TimeTicks processing_end_keyup = GetTimeStamp(6);
- base::TimeTicks swap_time_keyup = GetTimeStamp(13);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(13);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup, key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -699,7 +683,7 @@
"Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 0);
}
-TEST_P(WindowPerformanceTest, PressMultipleKeys) {
+TEST_F(WindowPerformanceTest, PressMultipleKeys) {
auto entries = GetUkmRecorder()->GetEntriesByName(
ukm::builders::Responsiveness_UserInteraction::kEntryName);
EXPECT_EQ(0u, entries.size());
@@ -707,42 +691,42 @@
base::TimeTicks keydown_timestamp = GetTimeOrigin();
base::TimeTicks processing_start_keydown = GetTimeStamp(1);
base::TimeTicks processing_end_keydown = GetTimeStamp(2);
- base::TimeTicks swap_time_keydown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(5);
int first_key_code = 2;
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
first_key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Press the second key.
processing_start_keydown = GetTimeStamp(2);
processing_end_keydown = GetTimeStamp(3);
- swap_time_keydown = GetTimeStamp(7);
+ presentation_time_keydown = GetTimeStamp(7);
int second_key_code = 4;
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
second_key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Release the first key.
base::TimeTicks keyup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_keyup = GetTimeStamp(5);
base::TimeTicks processing_end_keyup = GetTimeStamp(6);
- base::TimeTicks swap_time_keyup = GetTimeStamp(13);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(13);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup,
first_key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
// Release the second key.
keyup_timestamp = GetTimeStamp(5);
processing_start_keyup = GetTimeStamp(5);
processing_end_keyup = GetTimeStamp(6);
- swap_time_keyup = GetTimeStamp(20);
+ presentation_time_keyup = GetTimeStamp(20);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup,
second_key_code);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -773,12 +757,7 @@
// Test a real world scenario, where keydown got presented first but its
// callback got invoked later than keyup's due to multi processes & threading
// overhead.
-TEST_P(WindowPerformanceTest, KeyupFinishLastButCallbackInvokedFirst) {
- // This test only pass with the experiment features.
- if (!GetParam()) {
- return;
- }
-
+TEST_F(WindowPerformanceTest, KeyupFinishLastButCallbackInvokedFirst) {
// Arbitrary keycode picked for testing from
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#value_of_keycode
int digit_1_key_code = 0x31;
@@ -839,101 +818,35 @@
"Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 0);
}
-TEST_P(WindowPerformanceTest, ReportEventTimingOnRealPaintFeedback) {
- // This test only pass with the experiment features.
- if (!GetParam()) {
- return;
- }
-
- // Arbitrary keycode picked for testing from
- // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#value_of_keycode
- int digit_1_key_code = 0x31;
-
- // Keydown
- base::TimeTicks keydown_timestamp = GetTimeOrigin();
- base::TimeTicks processing_start_keydown = GetTimeStamp(1);
- base::TimeTicks processing_end_keydown = GetTimeStamp(4);
- RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
- processing_start_keydown, processing_end_keydown,
- digit_1_key_code);
-
- SimulatePaint();
-
- // Keyup
- base::TimeTicks keyup_timestamp = GetTimeStamp(5);
- base::TimeTicks processing_start_keyup = GetTimeStamp(6);
- base::TimeTicks processing_end_keyup = GetTimeStamp(7);
- base::TimeTicks presentation_promise_break_time_keyup = GetTimeStamp(8);
- RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
- processing_start_keyup, processing_end_keyup,
- digit_1_key_code);
-
- // The keydown & keyup result in two real paints, while we're only getting
- // presentation feedback of keyup.
- SimulatePaintAndResolvePresentationPromise(
- presentation_promise_break_time_keyup);
-
- // Flush UKM logging mojo request.
- RunPendingTasks();
-
- // Check UKM recording.
- auto entries = GetUkmRecorder()->GetEntriesByName(
- ukm::builders::Responsiveness_UserInteraction::kEntryName);
- EXPECT_EQ(1u, entries.size());
- const ukm::mojom::UkmEntry* ukm_entry = entries[0];
- // Events that are missing presentation feedbacks (keydown here) should
- // fallback ending time to their processingEnd.
- GetUkmRecorder()->ExpectEntryMetric(
- ukm_entry,
- ukm::builders::Responsiveness_UserInteraction::kMaxEventDurationName, 4);
- GetUkmRecorder()->ExpectEntryMetric(
- ukm_entry,
- ukm::builders::Responsiveness_UserInteraction::kTotalEventDurationName,
- 7);
- GetUkmRecorder()->ExpectEntryMetric(
- ukm_entry,
- ukm::builders::Responsiveness_UserInteraction::kInteractionTypeName, 0);
-
- // Check UMA recording.
- GetHistogramTester().ExpectTotalCount(
- "Blink.Responsiveness.UserInteraction.MaxEventDuration.AllTypes", 1);
- GetHistogramTester().ExpectTotalCount(
- "Blink.Responsiveness.UserInteraction.MaxEventDuration.Keyboard", 1);
- GetHistogramTester().ExpectTotalCount(
- "Blink.Responsiveness.UserInteraction.MaxEventDuration.TapOrClick", 0);
- GetHistogramTester().ExpectTotalCount(
- "Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 0);
-}
-
-TEST_P(WindowPerformanceTest, TapOrClick) {
+TEST_F(WindowPerformanceTest, TapOrClick) {
// Pointerdown
base::TimeTicks pointerdown_timestamp = GetTimeOrigin();
base::TimeTicks processing_start_pointerdown = GetTimeStamp(1);
base::TimeTicks processing_end_pointerdown = GetTimeStamp(2);
- base::TimeTicks swap_time_pointerdown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_pointerdown = GetTimeStamp(5);
PointerId pointer_id = 4;
RegisterPointerEvent(event_type_names::kPointerdown, pointerdown_timestamp,
processing_start_pointerdown, processing_end_pointerdown,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerdown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerdown);
// Pointerup
base::TimeTicks pointerup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_pointerup = GetTimeStamp(5);
base::TimeTicks processing_end_pointerup = GetTimeStamp(6);
- base::TimeTicks swap_time_pointerup = GetTimeStamp(10);
+ base::TimeTicks presentation_time_pointerup = GetTimeStamp(10);
RegisterPointerEvent(event_type_names::kPointerup, pointerup_timestamp,
processing_start_pointerup, processing_end_pointerup,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerup);
// Click
base::TimeTicks click_timestamp = GetTimeStamp(13);
base::TimeTicks processing_start_click = GetTimeStamp(15);
base::TimeTicks processing_end_click = GetTimeStamp(16);
- base::TimeTicks swap_time_click = GetTimeStamp(20);
+ base::TimeTicks presentation_time_click = GetTimeStamp(20);
RegisterPointerEvent(event_type_names::kClick, click_timestamp,
processing_start_click, processing_end_click,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_click);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_click);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -965,7 +878,7 @@
"Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 0);
}
-TEST_P(WindowPerformanceTest, PageVisibilityChanged) {
+TEST_F(WindowPerformanceTest, PageVisibilityChanged) {
// The page visibility gets changed.
PageVisibilityChanged(GetTimeStamp(18));
@@ -973,32 +886,32 @@
base::TimeTicks pointerdown_timestamp = GetTimeOrigin();
base::TimeTicks processing_start_pointerdown = GetTimeStamp(1);
base::TimeTicks processing_end_pointerdown = GetTimeStamp(2);
- base::TimeTicks swap_time_pointerdown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_pointerdown = GetTimeStamp(5);
PointerId pointer_id = 4;
RegisterPointerEvent(event_type_names::kPointerdown, pointerdown_timestamp,
processing_start_pointerdown, processing_end_pointerdown,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerdown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerdown);
// Pointerup
base::TimeTicks pointerup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_pointerup = GetTimeStamp(5);
base::TimeTicks processing_end_pointerup = GetTimeStamp(6);
- base::TimeTicks swap_time_pointerup = GetTimeStamp(20);
+ base::TimeTicks presentation_time_pointerup = GetTimeStamp(20);
RegisterPointerEvent(event_type_names::kPointerup, pointerup_timestamp,
processing_start_pointerup, processing_end_pointerup,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerup);
// Click
base::TimeTicks click_timestamp = GetTimeStamp(13);
base::TimeTicks processing_start_click = GetTimeStamp(15);
base::TimeTicks processing_end_click = GetTimeStamp(16);
- base::TimeTicks swap_time_click = GetTimeStamp(20);
+ base::TimeTicks presentation_time_click = GetTimeStamp(20);
RegisterPointerEvent(event_type_names::kClick, click_timestamp,
processing_start_click, processing_end_click,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_click);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_click);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -1027,37 +940,37 @@
ukm::builders::Responsiveness_UserInteraction::kInteractionTypeName, 1);
}
-TEST_P(WindowPerformanceTest, Drag) {
+TEST_F(WindowPerformanceTest, Drag) {
// Pointerdown
base::TimeTicks pointerdwon_timestamp = GetTimeOrigin();
base::TimeTicks processing_start_pointerdown = GetTimeStamp(1);
base::TimeTicks processing_end_pointerdown = GetTimeStamp(2);
- base::TimeTicks swap_time_pointerdown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_pointerdown = GetTimeStamp(5);
PointerId pointer_id = 4;
RegisterPointerEvent(event_type_names::kPointerdown, pointerdwon_timestamp,
processing_start_pointerdown, processing_end_pointerdown,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerdown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerdown);
// Notify drag.
performance_->NotifyPotentialDrag(pointer_id);
// Pointerup
base::TimeTicks pointerup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_pointerup = GetTimeStamp(5);
base::TimeTicks processing_end_pointerup = GetTimeStamp(6);
- base::TimeTicks swap_time_pointerup = GetTimeStamp(10);
+ base::TimeTicks presentation_time_pointerup = GetTimeStamp(10);
RegisterPointerEvent(event_type_names::kPointerup, pointerup_timestamp,
processing_start_pointerup, processing_end_pointerup,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerup);
// Click
base::TimeTicks click_timestamp = GetTimeStamp(13);
base::TimeTicks processing_start_click = GetTimeStamp(15);
base::TimeTicks processing_end_click = GetTimeStamp(16);
- base::TimeTicks swap_time_click = GetTimeStamp(20);
+ base::TimeTicks presentation_time_click = GetTimeStamp(20);
RegisterPointerEvent(event_type_names::kClick, click_timestamp,
processing_start_click, processing_end_click,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_click);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_click);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -1089,26 +1002,26 @@
"Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 1);
}
-TEST_P(WindowPerformanceTest, Scroll) {
+TEST_F(WindowPerformanceTest, Scroll) {
// Pointerdown
base::TimeTicks pointerdown_timestamp = GetTimeOrigin();
base::TimeTicks processing_start_keydown = GetTimeStamp(1);
base::TimeTicks processing_end_keydown = GetTimeStamp(2);
- base::TimeTicks swap_time_keydown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(5);
PointerId pointer_id = 5;
RegisterPointerEvent(event_type_names::kPointerdown, pointerdown_timestamp,
processing_start_keydown, processing_end_keydown,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Pointercancel
base::TimeTicks pointerup_timestamp = GetTimeStamp(3);
base::TimeTicks processing_start_keyup = GetTimeStamp(5);
base::TimeTicks processing_end_keyup = GetTimeStamp(6);
- base::TimeTicks swap_time_keyup = GetTimeStamp(10);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(10);
RegisterPointerEvent(event_type_names::kPointercancel, pointerup_timestamp,
processing_start_keyup, processing_end_keyup,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -1129,27 +1042,27 @@
"Blink.Responsiveness.UserInteraction.MaxEventDuration.Drag", 0);
}
-TEST_P(WindowPerformanceTest, TouchesWithoutClick) {
+TEST_F(WindowPerformanceTest, TouchesWithoutClick) {
base::TimeTicks pointerdown_timestamp = GetTimeOrigin();
// First Pointerdown
base::TimeTicks processing_start_pointerdown = GetTimeStamp(1);
base::TimeTicks processing_end_pointerdown = GetTimeStamp(2);
- base::TimeTicks swap_time_pointerdown = GetTimeStamp(5);
+ base::TimeTicks presentation_time_pointerdown = GetTimeStamp(5);
PointerId pointer_id = 4;
RegisterPointerEvent(event_type_names::kPointerdown, pointerdown_timestamp,
processing_start_pointerdown, processing_end_pointerdown,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerdown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerdown);
// Second Pointerdown
pointerdown_timestamp = GetTimeStamp(6);
processing_start_pointerdown = GetTimeStamp(7);
processing_end_pointerdown = GetTimeStamp(8);
- swap_time_pointerdown = GetTimeStamp(15);
+ presentation_time_pointerdown = GetTimeStamp(15);
RegisterPointerEvent(event_type_names::kPointerdown, pointerdown_timestamp,
processing_start_pointerdown, processing_end_pointerdown,
pointer_id);
- SimulatePaintAndResolvePresentationPromise(swap_time_pointerdown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_pointerdown);
// Flush UKM logging mojo request.
RunPendingTasks();
@@ -1164,7 +1077,7 @@
// Test artificial pointerup and click on MacOS fall back to use processingEnd
// as event duration ending time.
// See crbug.com/1321819
-TEST_P(WindowPerformanceTest, ArtificialPointerupOrClick) {
+TEST_F(WindowPerformanceTest, ArtificialPointerupOrClick) {
// Arbitrary keycode picked for testing
PointerId pointer_id = 4;
@@ -1230,7 +1143,7 @@
#if BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
// The trace_analyzer does not work on platforms on which the migration of
// tracing into Perfetto has not completed.
-TEST_P(WindowPerformanceTest, PerformanceMarkTraceEvent) {
+TEST_F(WindowPerformanceTest, PerformanceMarkTraceEvent) {
v8::HandleScope handle_scope(GetScriptState()->GetIsolate());
v8::Local<v8::Context> context = GetScriptState()->GetContext();
v8::Context::Scope context_scope(context);
@@ -1266,7 +1179,7 @@
}
#endif // BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
-TEST_P(WindowPerformanceTest, ElementTimingTraceEvent) {
+TEST_F(WindowPerformanceTest, ElementTimingTraceEvent) {
using trace_analyzer::Query;
trace_analyzer::Start("*");
// |element| needs to be non-null to prevent a crash.
@@ -1307,7 +1220,7 @@
EXPECT_EQ(*url, "url");
}
-TEST_P(WindowPerformanceTest, EventTimingTraceEvents) {
+TEST_F(WindowPerformanceTest, EventTimingTraceEvents) {
using trace_analyzer::Query;
trace_analyzer::Start("*");
base::TimeTicks start_time = GetTimeOrigin() + base::Seconds(1);
@@ -1317,8 +1230,8 @@
processing_start, processing_end, 4,
GetWindow()->document());
- base::TimeTicks swap_time = processing_end + base::Milliseconds(10);
- SimulatePaintAndResolvePresentationPromise(swap_time);
+ base::TimeTicks presentation_time = processing_end + base::Milliseconds(10);
+ SimulatePaintAndResolvePresentationPromise(presentation_time);
base::TimeTicks start_time2 = start_time + base::Milliseconds(100);
base::TimeTicks processing_start2 = start_time2 + base::Milliseconds(5);
@@ -1333,8 +1246,8 @@
RegisterPointerEvent(event_type_names::kClick, start_time3, processing_start3,
processing_end3, 4, GetWindow()->document());
- base::TimeTicks swap_time2 = processing_end3 + base::Milliseconds(5);
- SimulatePaintAndResolvePresentationPromise(swap_time2);
+ base::TimeTicks presentation_time2 = processing_end3 + base::Milliseconds(5);
+ SimulatePaintAndResolvePresentationPromise(presentation_time2);
// Only the longer event should have been reported.
auto analyzer = trace_analyzer::Stop();
@@ -1406,7 +1319,7 @@
EXPECT_FALSE(click_begin->other_event->HasDictArg("data"));
}
-TEST_P(WindowPerformanceTest, SlowInteractionToNextPaintTraceEvents) {
+TEST_F(WindowPerformanceTest, SlowInteractionToNextPaintTraceEvents) {
using trace_analyzer::Query;
trace_analyzer::Start("*");
@@ -1418,21 +1331,21 @@
base::TimeTicks keydown_timestamp = GetTimeStamp(0);
base::TimeTicks processing_start_keydown = GetTimeStamp(1);
base::TimeTicks processing_end_keydown = GetTimeStamp(2);
- base::TimeTicks swap_time_keydown = GetTimeStamp(20);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(20);
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Keyup.
base::TimeTicks keyup_timestamp = GetTimeStamp(10);
base::TimeTicks processing_start_keyup = GetTimeStamp(15);
base::TimeTicks processing_end_keyup = GetTimeStamp(50);
- base::TimeTicks swap_time_keyup = GetTimeStamp(110);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(110);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
}
// Single long event.
@@ -1441,21 +1354,21 @@
base::TimeTicks keydown_timestamp = GetTimeStamp(200);
base::TimeTicks processing_start_keydown = GetTimeStamp(201);
base::TimeTicks processing_end_keydown = GetTimeStamp(202);
- base::TimeTicks swap_time_keydown = GetTimeStamp(220);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(220);
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Keyup (start = 210, dur = 101ms).
base::TimeTicks keyup_timestamp = GetTimeStamp(210);
base::TimeTicks processing_start_keyup = GetTimeStamp(215);
base::TimeTicks processing_end_keyup = GetTimeStamp(250);
- base::TimeTicks swap_time_keyup = GetTimeStamp(311);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(311);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
}
// Overlapping events.
@@ -1464,41 +1377,41 @@
base::TimeTicks keydown_timestamp = GetTimeStamp(1000);
base::TimeTicks processing_start_keydown = GetTimeStamp(1001);
base::TimeTicks processing_end_keydown = GetTimeStamp(1002);
- base::TimeTicks swap_time_keydown = GetTimeStamp(1010);
+ base::TimeTicks presentation_time_keydown = GetTimeStamp(1010);
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp,
processing_start_keydown, processing_end_keydown,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown);
// Keyup (start = 1020, dur = 1000ms).
base::TimeTicks keyup_timestamp = GetTimeStamp(1020);
base::TimeTicks processing_start_keyup = GetTimeStamp(1030);
base::TimeTicks processing_end_keyup = GetTimeStamp(1040);
- base::TimeTicks swap_time_keyup = GetTimeStamp(2020);
+ base::TimeTicks presentation_time_keyup = GetTimeStamp(2020);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp,
processing_start_keyup, processing_end_keyup,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup);
// Keydown (quick).
base::TimeTicks keydown_timestamp2 = GetTimeStamp(1000);
base::TimeTicks processing_start_keydown2 = GetTimeStamp(1001);
base::TimeTicks processing_end_keydown2 = GetTimeStamp(1002);
- base::TimeTicks swap_time_keydown2 = GetTimeStamp(1010);
+ base::TimeTicks presentation_time_keydown2 = GetTimeStamp(1010);
RegisterKeyboardEvent(event_type_names::kKeydown, keydown_timestamp2,
processing_start_keydown2, processing_end_keydown2,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keydown2);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keydown2);
// Keyup (start = 1800, dur = 600ms).
base::TimeTicks keyup_timestamp2 = GetTimeStamp(1800);
base::TimeTicks processing_start_keyup2 = GetTimeStamp(1802);
base::TimeTicks processing_end_keyup2 = GetTimeStamp(1810);
- base::TimeTicks swap_time_keyup2 = GetTimeStamp(2400);
+ base::TimeTicks presentation_time_keyup2 = GetTimeStamp(2400);
RegisterKeyboardEvent(event_type_names::kKeyup, keyup_timestamp2,
processing_start_keyup2, processing_end_keyup2,
kKeyCode);
- SimulatePaintAndResolvePresentationPromise(swap_time_keyup2);
+ SimulatePaintAndResolvePresentationPromise(presentation_time_keyup2);
}
auto analyzer = trace_analyzer::Stop();
@@ -1524,7 +1437,7 @@
EXPECT_EQ(base::ClampRound(events[2]->GetAbsTimeToOtherEvent()), 600000);
}
-TEST_P(WindowPerformanceTest, InteractionID) {
+TEST_F(WindowPerformanceTest, InteractionID) {
// Keyboard with max duration 25, total duration 40.
PerformanceEventTiming* keydown_entry =
CreatePerformanceEventTiming(event_type_names::kKeydown);
@@ -1613,8 +1526,6 @@
}
}
-INSTANTIATE_TEST_SUITE_P(All, WindowPerformanceTest, ::testing::Bool());
-
class InteractionIdTest : public WindowPerformanceTest {
public:
struct EventForInteraction {
@@ -1688,7 +1599,7 @@
};
// Tests English typing.
-TEST_P(InteractionIdTest, InputOutsideComposition) {
+TEST_F(InteractionIdTest, InputOutsideComposition) {
// Insert "a" with a max duration of 50 and total of 50.
std::vector<EventForInteraction> events1 = {
{event_type_names::kKeydown, 65, absl::nullopt, GetTimeStamp(100),
@@ -1740,7 +1651,7 @@
}
// Tests Japanese on Mac.
-TEST_P(InteractionIdTest, CompositionSingleKeydown) {
+TEST_F(InteractionIdTest, CompositionSingleKeydown) {
// Insert "a" with a duration of 20.
std::vector<EventForInteraction> events1 = {
{event_type_names::kKeydown, 229, absl::nullopt, GetTimeStamp(100),
@@ -1779,7 +1690,7 @@
// Tests Chinese on Mac. Windows is similar, but has more keyups inside the
// composition.
-TEST_P(InteractionIdTest, CompositionToFinalInput) {
+TEST_F(InteractionIdTest, CompositionToFinalInput) {
// Insert "a" with a duration of 25.
std::vector<EventForInteraction> events1 = {
{event_type_names::kKeydown, 229, absl::nullopt, GetTimeStamp(100),
@@ -1824,7 +1735,7 @@
}
// Tests Chinese on Windows.
-TEST_P(InteractionIdTest, CompositionToFinalInputMultipleKeyUps) {
+TEST_F(InteractionIdTest, CompositionToFinalInputMultipleKeyUps) {
// Insert "a" with a duration of 66.
std::vector<EventForInteraction> events1 = {
{event_type_names::kKeydown, 229, absl::nullopt, GetTimeStamp(0),
@@ -1876,7 +1787,7 @@
}
// Tests Android smart suggestions (similar to Android Chinese).
-TEST_P(InteractionIdTest, SmartSuggestion) {
+TEST_F(InteractionIdTest, SmartSuggestion) {
// Insert "A" with a duration of 9.
std::vector<EventForInteraction> events1 = {
{event_type_names::kKeydown, 229, absl::nullopt, GetTimeStamp(0),
@@ -1918,7 +1829,7 @@
{43, 70, UserInteractionType::kKeyboard}});
}
-TEST_P(InteractionIdTest, TapWithoutClick) {
+TEST_F(InteractionIdTest, TapWithoutClick) {
std::vector<EventForInteraction> events = {
{event_type_names::kPointerdown, absl::nullopt, 1, GetTimeStamp(100),
GetTimeStamp(140)},
@@ -1939,7 +1850,7 @@
CheckUKMValues({{40, 50, UserInteractionType::kTapOrClick}});
}
-TEST_P(InteractionIdTest, PointerupClick) {
+TEST_F(InteractionIdTest, PointerupClick) {
std::vector<EventForInteraction> events = {
{event_type_names::kPointerup, absl::nullopt, 1, GetTimeStamp(100),
GetTimeStamp(140)},
@@ -1953,7 +1864,7 @@
CheckUKMValues({{40, 50, UserInteractionType::kTapOrClick}});
}
-TEST_P(InteractionIdTest, JustClick) {
+TEST_F(InteractionIdTest, JustClick) {
// Hitting enter on a keyboard may cause just a trusted click event.
std::vector<EventForInteraction> events = {
{event_type_names::kClick, absl::nullopt, -1, GetTimeStamp(120),
@@ -1965,7 +1876,7 @@
CheckUKMValues({{30, 30, UserInteractionType::kTapOrClick}});
}
-TEST_P(InteractionIdTest, PointerdownClick) {
+TEST_F(InteractionIdTest, PointerdownClick) {
// Contextmenus may cause us to only see pointerdown and click (no pointerup).
std::vector<EventForInteraction> events = {
{event_type_names::kPointerdown, absl::nullopt, 1, GetTimeStamp(100),
@@ -1980,7 +1891,7 @@
CheckUKMValues({{40, 50, UserInteractionType::kTapOrClick}});
}
-TEST_P(InteractionIdTest, MultiTouch) {
+TEST_F(InteractionIdTest, MultiTouch) {
// In multitouch, we report an interaction per pointerId. We do not see
// clicks.
std::vector<EventForInteraction> events = {
@@ -2005,7 +1916,7 @@
{50, 60, UserInteractionType::kTapOrClick}});
}
-TEST_P(InteractionIdTest, ClickIncorrectPointerId) {
+TEST_F(InteractionIdTest, ClickIncorrectPointerId) {
// On mobile, in cases where touchstart is skipped, click does not get the
// correct pointerId. See crbug.com/1264930 for more details.
std::vector<EventForInteraction> events = {
@@ -2021,5 +1932,4 @@
CheckUKMValues({{40, 60, UserInteractionType::kTapOrClick}});
}
-INSTANTIATE_TEST_SUITE_P(All, InteractionIdTest, ::testing::Bool());
} // namespace blink
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 7792ba7..f4e4f7d 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -10928,7 +10928,7 @@
<int value="4559"
label="ServiceWorkerBypassFetchHandlerForAllWithRaceNetworkRequestByOriginTrial"/>
<int value="4560"
- label="EventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved"/>
+ label="OBSOLETE_EventTimingPaintedPresentationPromiseResolvedWithEarlierPromiseUnresolved"/>
<int value="4561" label="LinkRelPreloadAsFont"/>
<int value="4562" label="CrossWindowAccessToBrowserGeneratedDocument"/>
<int value="4563" label="SpeculationRulesNoVarySearchHint"/>
@@ -10965,7 +10965,8 @@
<int value="4594" label="OBSOLETE_TextWrapPretty"/>
<int value="4595" label="OBSOLETE_TextWrapPrettyFail"/>
<int value="4596" label="ContainerQueryEvalUnknown"/>
- <int value="4597" label="EventTimingPresentationPromiseResolvedAfterReport"/>
+ <int value="4597"
+ label="OBSOLETE_EventTimingPresentationPromiseResolvedAfterReport"/>
<int value="4598" label="GetCoalescedEventsInInsecureContext"/>
<int value="4599" label="CSPEESameOriginBlanketEnforcement"/>
<int value="4601" label="SharedDictionaryUsed"/>
diff --git a/tools/metrics/histograms/metadata/page/histograms.xml b/tools/metrics/histograms/metadata/page/histograms.xml
index babc98d..687ef2d 100644
--- a/tools/metrics/histograms/metadata/page/histograms.xml
+++ b/tools/metrics/histograms/metadata/page/histograms.xml
@@ -2474,22 +2474,6 @@
</summary>
</histogram>
-<histogram name="PageLoad.Internal.EventTiming.PendingPresentationPromiseCount"
- units="count" expires_after="2024-06-30">
- <owner>zuoaoyuan@chromium.org</owner>
- <owner>speed-metrics-dev@chromium.org</owner>
- <summary>
- Records the number of unique presentation times that Event Timing has queued
- up, waiting to assign to Event Timing entries and dispatch to performance
- timeline. Recorded once every time a presentation promise resolves. The
- queue grows whenever a new presentation promise gets queued, and shrinks
- when it gets reported. Note that when a newer presentation promise gets
- resolved before an older one, we would delay reporting it so timings are
- reported in order. This should only happen whenever a newer presentation
- promise is not actually measuring to Next Paint.
- </summary>
-</histogram>
-
<histogram name="PageLoad.Internal.PageLoadTimingStatus{Condition}"
enum="PageLoadTimingStatus" expires_after="2024-06-30">
<owner>toyoshim@chromium.org</owner>