Commit 66363a3c authored by Regan Hsu's avatar Regan Hsu Committed by Commit Bot

[CrOS Settings] Record click count metrics.

Previously, the user click count inside settings was not being recorded.

Fixed: 1105551
Change-Id: I7c662a5727141f4b1730184be2e155c0dc8835dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2349908Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797096}
parent 6b36b504
......@@ -240,12 +240,17 @@ cr.define('settings', function() {
window.addEventListener('focus', settings.recordPageFocus);
window.addEventListener('blur', settings.recordPageBlur);
// Clicks need to be captured because unlike focus/blur to the settings
// window, a click's propagation can be stopped by child elements.
window.addEventListener('click', settings.recordClick, /*capture=*/true);
},
/** @override */
detached() {
window.removeEventListener('focus', settings.recordPageFocus);
window.removeEventListener('blur', settings.recordPageBlur);
window.removeEventListener('click', settings.recordClick);
settings.Router.getInstance().resetRouteForTesting();
},
......
......@@ -213,6 +213,12 @@ TEST_F('OSSettingsUIBrowserTest', 'AllJsTests', () => {
assertEquals(userActionRecorder.pageBlurCount, 1);
});
test('userActionClickEvent', () => {
assertEquals(userActionRecorder.clickCount, 0);
ui.fire('click');
assertEquals(userActionRecorder.clickCount, 1);
});
test('userActionFocusEvent', function() {
assertEquals(userActionRecorder.pageFocusCount, 0);
ui.fire('focus');
......
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