Commit 95031057 authored by Ravjit Singh Uppal's avatar Ravjit Singh Uppal Committed by Commit Bot

Fix bug in one time permissions metrics

Fixed issue where metrics were recorded as GEOLOCATION permission regardless what the permission was.

Bug: 1119738
Change-Id: Ib0f5d372727a26b9294536a03928a2d79305dea6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438369
Commit-Queue: Ravjit Singh Uppal <ravjit@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811775}
parent cbfdf600
...@@ -61,6 +61,10 @@ TEST_F(PageSpecificContentSettingsTest, HistogramTest) { ...@@ -61,6 +61,10 @@ TEST_F(PageSpecificContentSettingsTest, HistogramTest) {
// Count should stay same even after multiple usage of permission // Count should stay same even after multiple usage of permission
histograms.ExpectTotalCount(kGeolocationHistogramName, 1); histograms.ExpectTotalCount(kGeolocationHistogramName, 1);
content_settings->OnContentAllowed(ContentSettingsType::NOTIFICATIONS);
// Count should stay same even if a different permission is used
histograms.ExpectTotalCount(kGeolocationHistogramName, 1);
PageSpecificContentSettings::MicrophoneCameraState microphone_accessed = PageSpecificContentSettings::MicrophoneCameraState microphone_accessed =
PageSpecificContentSettings::MICROPHONE_ACCESSED | PageSpecificContentSettings::MICROPHONE_ACCESSED |
PageSpecificContentSettings::CAMERA_ACCESSED | PageSpecificContentSettings::CAMERA_ACCESSED |
...@@ -90,6 +94,10 @@ TEST_F(PageSpecificContentSettingsTest, HistogramTest) { ...@@ -90,6 +94,10 @@ TEST_F(PageSpecificContentSettingsTest, HistogramTest) {
// Count should stay same even after multiple usage of permission // Count should stay same even after multiple usage of permission
histograms.ExpectTotalCount(kMicrophoneHistogramName, 1); histograms.ExpectTotalCount(kMicrophoneHistogramName, 1);
histograms.ExpectTotalCount(kCameraHistogramName, 1); histograms.ExpectTotalCount(kCameraHistogramName, 1);
// Count should stay same even if a different permission is used
histograms.ExpectTotalCount(kMicrophoneHistogramName, 1);
histograms.ExpectTotalCount(kCameraHistogramName, 1);
} }
} // namespace content_settings } // namespace content_settings
...@@ -577,7 +577,7 @@ void PageSpecificContentSettings::OnContentAllowed(ContentSettingsType type) { ...@@ -577,7 +577,7 @@ void PageSpecificContentSettings::OnContentAllowed(ContentSettingsType type) {
if (!status.allowed) { if (!status.allowed) {
status.allowed = true; status.allowed = true;
access_changed = true; access_changed = true;
delegate_->OnContentAllowed(ContentSettingsType::GEOLOCATION); delegate_->OnContentAllowed(type);
} }
if (access_changed) if (access_changed)
......
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