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

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

Issue 1478643002: Refactor media out of WebContentsImpl to MediaWebContentsObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove cruft. Created 5 years 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/test/histogram_tester.h" 6 #include "base/test/histogram_tester.h"
7 #include "base/timer/mock_timer.h" 7 #include "base/timer/mock_timer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/engagement/site_engagement_helper.h" 9 #include "chrome/browser/engagement/site_engagement_helper.h"
10 #include "chrome/browser/engagement/site_engagement_service.h" 10 #include "chrome/browser/engagement/site_engagement_service.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 blink::WebInputEvent::Type type) { 46 blink::WebInputEvent::Type type) {
47 helper->input_tracker_.DidGetUserInteraction(type); 47 helper->input_tracker_.DidGetUserInteraction(type);
48 helper->input_tracker_.TrackingStarted(); 48 helper->input_tracker_.TrackingStarted();
49 } 49 }
50 50
51 void HandleMediaPlaying(SiteEngagementHelper* helper, bool is_hidden) { 51 void HandleMediaPlaying(SiteEngagementHelper* helper, bool is_hidden) {
52 helper->RecordMediaPlaying(is_hidden); 52 helper->RecordMediaPlaying(is_hidden);
53 } 53 }
54 54
55 void MediaStartedPlaying(SiteEngagementHelper* helper) { 55 void MediaStartedPlaying(SiteEngagementHelper* helper) {
56 helper->media_tracker_.MediaStartedPlaying(); 56 helper->media_tracker_.MediaStartedPlaying(
57 content::WebContentsObserver::MediaPlayerId(nullptr, 1));
57 } 58 }
58 59
59 void MediaPaused(SiteEngagementHelper* helper) { 60 void MediaPaused(SiteEngagementHelper* helper) {
60 helper->media_tracker_.MediaPaused(); 61 helper->media_tracker_.MediaPaused(
62 content::WebContentsObserver::MediaPlayerId(nullptr, 1));
61 } 63 }
62 64
63 // Set a pause timer on the input tracker for test purposes. 65 // Set a pause timer on the input tracker for test purposes.
64 void SetInputTrackerPauseTimer(SiteEngagementHelper* helper, 66 void SetInputTrackerPauseTimer(SiteEngagementHelper* helper,
65 scoped_ptr<base::Timer> timer) { 67 scoped_ptr<base::Timer> timer) {
66 helper->input_tracker_.SetPauseTimerForTesting(timer.Pass()); 68 helper->input_tracker_.SetPauseTimerForTesting(timer.Pass());
67 } 69 }
68 70
69 // Set a pause timer on the input tracker for test purposes. 71 // Set a pause timer on the input tracker for test purposes.
70 void SetMediaTrackerPauseTimer(SiteEngagementHelper* helper, 72 void SetMediaTrackerPauseTimer(SiteEngagementHelper* helper,
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 // When the timer fires, callbacks are added. 574 // When the timer fires, callbacks are added.
573 input_tracker_timer->Fire(); 575 input_tracker_timer->Fire();
574 EXPECT_FALSE(input_tracker_timer->IsRunning()); 576 EXPECT_FALSE(input_tracker_timer->IsRunning());
575 EXPECT_TRUE(IsTrackingInput(helper.get())); 577 EXPECT_TRUE(IsTrackingInput(helper.get()));
576 578
577 // Navigation should start the initial delay timer again. 579 // Navigation should start the initial delay timer again.
578 NavigateWithDisposition(url1, CURRENT_TAB); 580 NavigateWithDisposition(url1, CURRENT_TAB);
579 EXPECT_TRUE(input_tracker_timer->IsRunning()); 581 EXPECT_TRUE(input_tracker_timer->IsRunning());
580 EXPECT_FALSE(IsTrackingInput(helper.get())); 582 EXPECT_FALSE(IsTrackingInput(helper.get()));
581 } 583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698