Merge "Simplify GrReporting.appStarted() to use this.now()"
This commit is contained in:
commit
1656bd9838
@ -234,10 +234,8 @@
|
|||||||
* User-perceived app start time, should be reported when the app is ready.
|
* User-perceived app start time, should be reported when the app is ready.
|
||||||
*/
|
*/
|
||||||
appStarted(hidden) {
|
appStarted(hidden) {
|
||||||
const startTime =
|
|
||||||
new Date().getTime() - this.performanceTiming.navigationStart;
|
|
||||||
this.reporter(TIMING.TYPE, TIMING.CATEGORY_UI_LATENCY,
|
this.reporter(TIMING.TYPE, TIMING.CATEGORY_UI_LATENCY,
|
||||||
TIMING.APP_STARTED, startTime);
|
TIMING.APP_STARTED, this.now());
|
||||||
if (hidden) {
|
if (hidden) {
|
||||||
this.reporter(PAGE_VISIBILITY.TYPE, PAGE_VISIBILITY.CATEGORY,
|
this.reporter(PAGE_VISIBILITY.TYPE, PAGE_VISIBILITY.CATEGORY,
|
||||||
PAGE_VISIBILITY.STARTED_HIDDEN);
|
PAGE_VISIBILITY.STARTED_HIDDEN);
|
||||||
|
@ -61,11 +61,11 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('appStarted', () => {
|
test('appStarted', () => {
|
||||||
|
sandbox.stub(element, 'now').returns(42);
|
||||||
element.appStarted(true);
|
element.appStarted(true);
|
||||||
assert.isTrue(
|
assert.isTrue(
|
||||||
element.reporter.calledWithExactly(
|
element.reporter.calledWithExactly(
|
||||||
'timing-report', 'UI Latency', 'App Started',
|
'timing-report', 'UI Latency', 'App Started', 42
|
||||||
NOW_TIME - fakePerformance.navigationStart
|
|
||||||
));
|
));
|
||||||
assert.isTrue(
|
assert.isTrue(
|
||||||
element.reporter.calledWithExactly(
|
element.reporter.calledWithExactly(
|
||||||
|
Loading…
Reference in New Issue
Block a user