Ensure WebComponentsReady latency is reported

Change-Id: I5061b6dcf390e59a5fa2bd461b252ae01459e747
This commit is contained in:
Viktar Donich
2018-04-23 11:42:06 -07:00
parent 36e8ba4168
commit b35c14e852
2 changed files with 12 additions and 1 deletions

View File

@@ -46,13 +46,16 @@
STARTUP_CHANGE_DISPLAYED: 'StartupChangeDisplayed',
STARTUP_DASHBOARD_DISPLAYED: 'StartupDashboardDisplayed',
STARTUP_DIFF_VIEW_DISPLAYED: 'StartupDiffViewDisplayed',
WEB_COMPONENTS_READY: 'WebComponentsReady',
};
const STARTUP_TIMERS = {};
STARTUP_TIMERS[TIMER.PLUGINS_LOADED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_CHANGE_DISPLAYED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_DIFF_VIEW_DISPLAYED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_DASHBOARD_DISPLAYED] = 0;
STARTUP_TIMERS[TIMER.STARTUP_DIFF_VIEW_DISPLAYED] = 0;
// WebComponentsReady timer is triggered from gr-router.
STARTUP_TIMERS[TIMER.WEB_COMPONENTS_READY] = 0;
const INTERACTION_TYPE = 'interaction';

View File

@@ -69,6 +69,14 @@ limitations under the License.
));
});
test('WebComponentsReady', () => {
sandbox.stub(element, 'now').returns(42);
element.timeEnd('WebComponentsReady');
assert.isTrue(element.reporter.calledWithExactly(
'timing-report', 'UI Latency', 'WebComponentsReady', 42
));
});
test('pageLoaded', () => {
element.pageLoaded();
assert.isTrue(