Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: chrome/browser/engagement/site_engagement_service_browsertest.cc

Issue 1368533004: Add UMA metrics to the site engagement service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@time-on-site
Patch Set: Refactor addressing reviewer comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/observer_list.h" 6 #include "base/observer_list.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "base/test/simple_test_clock.h" 10 #include "base/test/simple_test_clock.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 void EnableCallbackRegistration() { 61 void EnableCallbackRegistration() {
62 enable_callbacks_ = true; 62 enable_callbacks_ = true;
63 } 63 }
64 64
65 void DisableCallbackRegistration() { 65 void DisableCallbackRegistration() {
66 enable_callbacks_ = false; 66 enable_callbacks_ = false;
67 } 67 }
68 68
69 void RecordUserInput() override { 69 void RecordUserInput(SiteEngagementMetrics::EngagementType type) override {
70 SiteEngagementHelper::RecordUserInput(); 70 SiteEngagementHelper::RecordUserInput(type);
71 FOR_EACH_OBSERVER(Observer, observer_list_, OnInputRecorded(this)); 71 FOR_EACH_OBSERVER(Observer, observer_list_, OnInputRecorded(this));
72 } 72 }
73 73
74 private: 74 private:
75 friend class SiteEngagementServiceBrowserTest; 75 friend class SiteEngagementServiceBrowserTest;
76 base::ObserverList<Observer> observer_list_; 76 base::ObserverList<Observer> observer_list_;
77 bool enable_callbacks_; 77 bool enable_callbacks_;
78 78
79 }; 79 };
80 80
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 516
517 // Timer runs after input is recorded, and after it fires the callbacks are 517 // Timer runs after input is recorded, and after it fires the callbacks are
518 // added. 518 // added.
519 EXPECT_FALSE(CallbacksAdded(helper.get())); 519 EXPECT_FALSE(CallbacksAdded(helper.get()));
520 EXPECT_TRUE(timer->IsRunning()); 520 EXPECT_TRUE(timer->IsRunning());
521 timer->Fire(); 521 timer->Fire();
522 EXPECT_FALSE(timer->IsRunning()); 522 EXPECT_FALSE(timer->IsRunning());
523 EXPECT_TRUE(CallbacksAdded(helper.get())); 523 EXPECT_TRUE(CallbacksAdded(helper.get()));
524 } 524 }
525 } 525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698