Simplify GrReporting.appStarted() to use this.now()
Change-Id: I90041b2bf585a50a2ad533a9a587c6ca5d765642
diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
index cca5635..59af36d 100644
--- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
+++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
@@ -234,10 +234,8 @@
* User-perceived app start time, should be reported when the app is ready.
*/
appStarted(hidden) {
- const startTime =
- new Date().getTime() - this.performanceTiming.navigationStart;
this.reporter(TIMING.TYPE, TIMING.CATEGORY_UI_LATENCY,
- TIMING.APP_STARTED, startTime);
+ TIMING.APP_STARTED, this.now());
if (hidden) {
this.reporter(PAGE_VISIBILITY.TYPE, PAGE_VISIBILITY.CATEGORY,
PAGE_VISIBILITY.STARTED_HIDDEN);
diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html
index 8b85074..2087790 100644
--- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html
+++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html
@@ -61,11 +61,11 @@
});
test('appStarted', () => {
+ sandbox.stub(element, 'now').returns(42);
element.appStarted(true);
assert.isTrue(
element.reporter.calledWithExactly(
- 'timing-report', 'UI Latency', 'App Started',
- NOW_TIME - fakePerformance.navigationStart
+ 'timing-report', 'UI Latency', 'App Started', 42
));
assert.isTrue(
element.reporter.calledWithExactly(