chromium/components/site_engagement/content/site_engagement_helper_unittest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/site_engagement/content/site_engagement_helper.h"

#include <memory>

#include "base/memory/ptr_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/timer/mock_timer.h"
#include "base/values.h"
#include "components/permissions/test/test_permissions_client.h"
#include "components/prefs/testing_pref_service.h"
#include "components/site_engagement/content/engagement_type.h"
#include "components/site_engagement/content/site_engagement_metrics.h"
#include "components/site_engagement/content/site_engagement_score.h"
#include "components/site_engagement/content/site_engagement_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_touch_event.h"

namespace site_engagement {

NavigationSimulator;

class TestSiteEngagementServiceProvider
    : public SiteEngagementService::ServiceProvider {};

class SiteEngagementHelperTest : public content::RenderViewHostTestHarness {};

TEST_F(SiteEngagementHelperTest, KeyPressEngagementAccumulation) {}

TEST_F(SiteEngagementHelperTest, MouseDownEventEngagementAccumulation) {}

TEST_F(SiteEngagementHelperTest, ScrollEventEngagementAccumulation) {}

TEST_F(SiteEngagementHelperTest, TouchEngagementAccumulation) {}

TEST_F(SiteEngagementHelperTest, MediaEngagementAccumulation) {}

TEST_F(SiteEngagementHelperTest, MediaEngagement) {}

TEST_F(SiteEngagementHelperTest, MixedInputEngagementAccumulation) {}

TEST_F(SiteEngagementHelperTest, CheckTimerAndCallbacks) {}

// Ensure that navigation and tab activation/hiding does not trigger input
// tracking until after a delay. We must manually call WasShown/WasHidden as
// they are not triggered automatically in this test environment.
TEST_F(SiteEngagementHelperTest, ShowAndHide) {}

// Verify that the site engagement helper:
// - Doesn't reset input tracking on a visible <-> occluded transition.
// - Handles a hidden <-> occluded transition like a hidden <-> visible
//   transition.
TEST_F(SiteEngagementHelperTest, Occlusion) {}

// Ensure tracking behavior is correct for multiple navigations in a single tab.
TEST_F(SiteEngagementHelperTest, SingleTabNavigation) {}

}  // namespace site_engagement