Commit 6fa3cf88 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Chromium LUCI CQ

PDF Viewer: Add metrics for presentation mode and document properties

Bug: 93619, 1148478
Change-Id: I7a7d46dcaa216731741dc9ab9fc83e0ac0598223
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623724
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842626}
parent f75e96cd
......@@ -221,12 +221,14 @@ export class ViewerPdfToolbarNewElement extends PolymerElement {
/** @private */
onPresentClick_() {
assert(this.presentationModeEnabled);
PDFMetrics.record(UserAction.PRESENT);
this.getMenu_().close();
this.dispatchEvent(new CustomEvent('present-click'));
}
/** @private */
onPropertiesClick_() {
PDFMetrics.record(UserAction.PROPERTIES);
this.getMenu_().close();
this.dispatchEvent(new CustomEvent('properties-click'));
}
......
......@@ -212,7 +212,15 @@ export const UserAction = {
TOGGLE_DISPLAY_ANNOTATIONS_FIRST: 59,
TOGGLE_DISPLAY_ANNOTATIONS: 60,
NUMBER_OF_ACTIONS: 61,
// Recorded when the present menu item is clicked.
PRESENT_FIRST: 61,
PRESENT: 62,
// Recorded when the document properties menu item is clicked.
PROPERTIES_FIRST: 63,
PROPERTIES: 64,
NUMBER_OF_ACTIONS: 65,
};
// Map from UserAction to the 'FIRST' action. These metrics are recorded
......@@ -339,4 +347,12 @@ const firstMap = new Map([
UserAction.TOGGLE_DISPLAY_ANNOTATIONS,
UserAction.TOGGLE_DISPLAY_ANNOTATIONS_FIRST,
],
[
UserAction.PRESENT,
UserAction.PRESENT_FIRST,
],
[
UserAction.PROPERTIES,
UserAction.PROPERTIES_FIRST,
],
]);
......@@ -250,5 +250,35 @@ chrome.test.runTests(function() {
chrome.metricsPrivate.actionCounter);
chrome.test.succeed();
},
function testMetricsOverflowMenu() {
PDFMetrics.resetForTesting();
chrome.metricsPrivate = new MockMetricsPrivate();
PDFMetrics.record(UserAction.DOCUMENT_OPENED);
PDFMetrics.record(UserAction.TOGGLE_DISPLAY_ANNOTATIONS);
PDFMetrics.record(UserAction.PRESENT);
PDFMetrics.record(UserAction.PROPERTIES);
PDFMetrics.record(UserAction.PRESENT);
PDFMetrics.record(UserAction.PRESENT);
PDFMetrics.record(UserAction.PROPERTIES);
PDFMetrics.record(UserAction.TOGGLE_DISPLAY_ANNOTATIONS);
PDFMetrics.record(UserAction.PROPERTIES);
PDFMetrics.record(UserAction.PRESENT);
chrome.test.assertEq(
{
[UserAction.DOCUMENT_OPENED]: 1,
[UserAction.TOGGLE_DISPLAY_ANNOTATIONS_FIRST]: 1,
[UserAction.TOGGLE_DISPLAY_ANNOTATIONS]: 2,
[UserAction.PRESENT_FIRST]: 1,
[UserAction.PRESENT]: 4,
[UserAction.PROPERTIES_FIRST]: 1,
[UserAction.PROPERTIES]: 3,
},
chrome.metricsPrivate.actionCounter);
chrome.test.succeed();
},
];
}());
......@@ -10383,6 +10383,10 @@ histogram as enum -->
<int value="58" label="SelectSidenavOutline"/>
<int value="59" label="ToggleDisplayAnnotationsFirst"/>
<int value="60" label="ToggleDisplayAnnotations"/>
<int value="61" label="PresentFirst"/>
<int value="62" label="Present"/>
<int value="63" label="PropertiesFirst"/>
<int value="64" label="Properties"/>
</enum>
<enum name="ChromePDFViewerAnnotationType">
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