Commit 0a6b33e2 authored by François Beaufort's avatar François Beaufort Committed by Commit Bot

[Media Engagement] Filter out origins whose playback is 0 in about:media-engagement

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I042e565d27078e50ae6ac3ce01726452df3a9e2d
Reviewed-on: https://chromium-review.googlesource.com/886943
Commit-Queue: Mounir Lamouri (slow) <mlamouri@chromium.org>
Reviewed-by: default avatarMounir Lamouri (slow) <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533255}
parent 9990e648
......@@ -115,6 +115,12 @@
<tbody id="config-table-body">
</tbody>
</table>
<p>
<label>
<input id="show-no-playbacks" type="checkbox">
Show no playbacks
</label>
</p>
<table>
<thead>
<tr id="engagement-table-header">
......
......@@ -19,6 +19,7 @@ var engagementTableBody = null;
var sortReverse = true;
var sortKey = 'totalScore';
var configTableBody = null;
var showNoPlaybacks = false;
/**
* Creates a single row in the engagement table.
......@@ -121,7 +122,8 @@ function renderConfigTable(config) {
function renderTable() {
clearTable();
sortInfo();
info.forEach(rowInfo => engagementTableBody.appendChild(createRow(rowInfo)));
info.filter(rowInfo => (showNoPlaybacks || rowInfo.mediaPlaybacks > 0))
.forEach(rowInfo => engagementTableBody.appendChild(createRow(rowInfo)));
}
/**
......@@ -186,5 +188,14 @@ document.addEventListener('DOMContentLoaded', function() {
// And deselect everything at the end.
window.getSelection().removeAllRanges();
});
// Add handler to 'show no playbacks' checkbox
var showNoPlaybacksCheckbox = $('show-no-playbacks');
showNoPlaybacksCheckbox.addEventListener('change', (e) => {
showNoPlaybacks = e.target.checked;
renderTable();
});
});
})();
......@@ -12,7 +12,7 @@ var EXAMPLE_URL_2 = 'http://shmlexample.com/';
GEN('#include "chrome/browser/media/media_engagement_service.h"');
GEN('#include "chrome/browser/media/media_engagement_service_factory.h"');
GEN('#include "chrome/browser/ui/browser.h"');
GEN('#include "media/base/media_switches.h"')
GEN('#include "media/base/media_switches.h"');
function MediaEngagementWebUIBrowserTest() {}
......@@ -33,6 +33,8 @@ MediaEngagementWebUIBrowserTest.prototype = {
GEN(' browser()->profile());');
GEN('service->RecordVisit(GURL("' + EXAMPLE_URL_1 + '"));');
GEN('service->RecordVisit(GURL("' + EXAMPLE_URL_2 + '"));');
GEN('service->RecordPlayback(GURL("' + EXAMPLE_URL_1 + '"));');
GEN('service->RecordPlayback(GURL("' + EXAMPLE_URL_2 + '"));');
},
extraLibraries: [
......
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