#include "base/test/bind.h"
#include "chrome/browser/metrics/usage_scenario/tab_usage_scenario_tracker.h"
#include <memory>
#include "base/memory/raw_ptr.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/metrics/tab_stats/tab_stats_tracker.h"
#include "chrome/browser/metrics/usage_scenario/usage_scenario_data_store.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_unit_external.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/visibility.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_utils.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace metrics {
namespace {
constexpr base::TimeDelta kInterval = …;
void DiscardTab(content::WebContents* contents) { … }
class FullscreenEventsWaiter : public content::WebContentsObserver { … };
}
class TabUsageScenarioTrackerBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest, BasicNavigations) { … }
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest, TabCrash) { … }
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest, TabDiscard) { … }
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest, FullScreenVideo) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_FullScreenVideoClosed …
#else
#define MAYBE_FullScreenVideoClosed …
#endif
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest,
MAYBE_FullScreenVideoClosed) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_FullScreenVideoCrash …
#else
#define MAYBE_FullScreenVideoCrash …
#endif
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest,
MAYBE_FullScreenVideoCrash) { … }
IN_PROC_BROWSER_TEST_F(TabUsageScenarioTrackerBrowserTest,
InitialVisibleNotification) { … }
}