Commit 809e79dc authored by Michael Giuffrida's avatar Michael Giuffrida Committed by Commit Bot

Test UKMs in TabActivityWatcher

Adds unit tests that simulate tab activity and test the UKMs logged by
TabMetricsLogger.

Bug: 784639
Change-Id: Id5854b3e2b38b98ecc3d654ac93a24578e26ae3d
Reviewed-on: https://chromium-review.googlesource.com/791868
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520604}
parent 706ede78
...@@ -97,14 +97,6 @@ void TabActivityWatcher::DisableLogTimeoutForTest() { ...@@ -97,14 +97,6 @@ void TabActivityWatcher::DisableLogTimeoutForTest() {
per_source_log_timeout_ = base::TimeDelta(); per_source_log_timeout_ = base::TimeDelta();
} }
void TabActivityWatcher::SetTabMetricsLoggerForTest(
std::unique_ptr<TabMetricsLogger> tab_metrics_logger) {
if (tab_metrics_logger)
tab_metrics_logger_ = std::move(tab_metrics_logger);
else
tab_metrics_logger_ = std::make_unique<TabMetricsLoggerImpl>();
}
void TabActivityWatcher::TabPinnedStateChanged(TabStripModel* tab_strip_model, void TabActivityWatcher::TabPinnedStateChanged(TabStripModel* tab_strip_model,
content::WebContents* contents, content::WebContents* contents,
int index) { int index) {
......
...@@ -32,9 +32,6 @@ class TabActivityWatcher : public TabStripModelObserver, ...@@ -32,9 +32,6 @@ class TabActivityWatcher : public TabStripModelObserver,
// Forces logging even when a timeout would have prevented it. // Forces logging even when a timeout would have prevented it.
void DisableLogTimeoutForTest(); void DisableLogTimeoutForTest();
void SetTabMetricsLoggerForTest(
std::unique_ptr<TabMetricsLogger> tab_metrics_logger);
// Returns the single instance, creating it if necessary. // Returns the single instance, creating it if necessary.
static TabActivityWatcher* GetInstance(); static TabActivityWatcher* GetInstance();
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
// Logs a TabManager.TabMetrics UKM for a tab when requested. Includes // Logs a TabManager.TabMetrics UKM for a tab when requested. Includes
// information relevant to the tab and its WebContents. // information relevant to the tab and its WebContents.
// Must be used on the UI thread. // Must be used on the UI thread.
// TODO(michaelpg): Unit test for UKMs.
class TabMetricsLoggerImpl : public TabMetricsLogger { class TabMetricsLoggerImpl : public TabMetricsLogger {
public: public:
TabMetricsLoggerImpl(); TabMetricsLoggerImpl();
......
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