Skip to content

Commit

Permalink
[ntp][modules][photos] Fix typo in histogram logging
Browse files Browse the repository at this point in the history
Bug: 1260229
Change-Id: I0a91b2b72a1abf3d5d2348377b303d0e29b95c4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3224801
Commit-Queue: Jeremy Selier <jerem@google.com>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Auto-Submit: Jeremy Selier <jerem@google.com>
Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#931855}
  • Loading branch information
jeremys authored and Chromium LUCI CQ committed Oct 15, 2021
1 parent a0cb006 commit 6443351
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class PhotosModuleElement extends mixinBehaviors
super.ready();
this.addEventListener('detect-impression', e => {
chrome.metricsPrivate.recordBoolean(
'NewTabPage.Photos.ModuleShownWithOptInScreen', this.showOptInScreen);
'NewTabPage.Photos.ModuleShown', this.showOptInScreen);
});
}

Expand Down
20 changes: 6 additions & 14 deletions chrome/test/data/webui/new_tab_page/modules/photos/module_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ suite('NewTabPageModulesPhotosModuleTest', () => {
document.body.append(module);
await handler.whenCalled('getMemories');
await handler.whenCalled('shouldShowOptInScreen');
assertEquals(
0,
metrics.count('NewTabPage.Photos.ModuleShownWithOptInScreen', false));
assertEquals(0, metrics.count('NewTabPage.Photos.ModuleShown', false));
module.dispatchEvent(new Event('detect-impression'));

// Assert.
Expand All @@ -63,9 +61,7 @@ suite('NewTabPageModulesPhotosModuleTest', () => {
'Title 1', items[0].querySelector('.memory-title').textContent);
assertEquals(
'Title 2', items[1].querySelector('.memory-title').textContent);
assertEquals(
1,
metrics.count('NewTabPage.Photos.ModuleShownWithOptInScreen', false));
assertEquals(1, metrics.count('NewTabPage.Photos.ModuleShown', false));
});

test('module does not show without data', async () => {
Expand Down Expand Up @@ -271,14 +267,12 @@ suite('NewTabPageModulesPhotosModuleTest', () => {
document.body.append(module);
await handler.whenCalled('getMemories');
await handler.whenCalled('shouldShowOptInScreen');
assertEquals(
0, metrics.count('NewTabPage.Photos.ModuleShownWithOptInScreen', true));
assertEquals(0, metrics.count('NewTabPage.Photos.ModuleShown', true));
module.dispatchEvent(new Event('detect-impression'));

// Asserts.
assertTrue(!!$$(module, '#optInCard'));
assertEquals(
1, metrics.count('NewTabPage.Photos.ModuleShownWithOptInScreen', true));
assertEquals(1, metrics.count('NewTabPage.Photos.ModuleShown', true));

// Act.
const disable = {event: null};
Expand Down Expand Up @@ -312,14 +306,12 @@ suite('NewTabPageModulesPhotosModuleTest', () => {
document.body.append(module);
await handler.whenCalled('getMemories');
await handler.whenCalled('shouldShowOptInScreen');
assertEquals(
0, metrics.count('NewTabPage.Photos.ModuleShownWithOptInScreen', true));
assertEquals(0, metrics.count('NewTabPage.Photos.ModuleShown', true));
module.dispatchEvent(new Event('detect-impression'));

// Asserts.
assertTrue(!!$$(module, '#optInCard'));
assertEquals(
1, metrics.count('NewTabPage.Photos.ModuleShownWithOptInScreen', true));
assertEquals(1, metrics.count('NewTabPage.Photos.ModuleShown', true));

// Act.
$$(module, '#optInButton').click();
Expand Down

0 comments on commit 6443351

Please sign in to comment.