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

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

Issue 1622413002: Update user input event's engagement value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@first_nav_bonus
Patch Set: address nits Created 4 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/engagement/site_engagement_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/engagement/site_engagement_helper.h" 5 #include "chrome/browser/engagement/site_engagement_helper.h"
6 6
7 #include "base/test/histogram_tester.h" 7 #include "base/test/histogram_tester.h"
8 #include "base/timer/mock_timer.h" 8 #include "base/timer/mock_timer.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/engagement/site_engagement_service.h" 10 #include "chrome/browser/engagement/site_engagement_service.h"
11 #include "chrome/browser/engagement/site_engagement_service_factory.h" 11 #include "chrome/browser/engagement/site_engagement_service_factory.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/browser/navigation_entry.h" 15 #include "content/public/browser/navigation_entry.h"
16 #include "content/public/browser/page_navigator.h" 16 #include "content/public/browser/page_navigator.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/test/web_contents_tester.h" 18 #include "content/public/test/web_contents_tester.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 class SiteEngagementHelperTest : public ChromeRenderViewHostTestHarness { 21 class SiteEngagementHelperTest : public ChromeRenderViewHostTestHarness {
22 public: 22 public:
23 void SetUp() override { 23 void SetUp() override {
24 ChromeRenderViewHostTestHarness::SetUp(); 24 ChromeRenderViewHostTestHarness::SetUp();
25 SiteEngagementScore::DisableFirstDailyEngagementBonusForTesting(); 25 SiteEngagementScore::SetParamValuesForTesting();
26 } 26 }
27 27
28 SiteEngagementHelper* GetHelper(content::WebContents* web_contents) { 28 SiteEngagementHelper* GetHelper(content::WebContents* web_contents) {
29 SiteEngagementHelper::CreateForWebContents(web_contents); 29 SiteEngagementHelper::CreateForWebContents(web_contents);
30 SiteEngagementHelper* helper = 30 SiteEngagementHelper* helper =
31 SiteEngagementHelper::FromWebContents(web_contents); 31 SiteEngagementHelper::FromWebContents(web_contents);
32 32
33 DCHECK(helper); 33 DCHECK(helper);
34 return helper; 34 return helper;
35 } 35 }
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // When the timer fires, callbacks are added. 571 // When the timer fires, callbacks are added.
572 input_tracker_timer->Fire(); 572 input_tracker_timer->Fire();
573 EXPECT_FALSE(input_tracker_timer->IsRunning()); 573 EXPECT_FALSE(input_tracker_timer->IsRunning());
574 EXPECT_TRUE(IsTrackingInput(helper)); 574 EXPECT_TRUE(IsTrackingInput(helper));
575 575
576 // Navigation should start the initial delay timer again. 576 // Navigation should start the initial delay timer again.
577 Navigate(url1); 577 Navigate(url1);
578 EXPECT_TRUE(input_tracker_timer->IsRunning()); 578 EXPECT_TRUE(input_tracker_timer->IsRunning());
579 EXPECT_FALSE(IsTrackingInput(helper)); 579 EXPECT_FALSE(IsTrackingInput(helper));
580 } 580 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/engagement/site_engagement_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698