chromium/chrome/browser/resource_coordinator/tab_lifecycle_unit_unittest.cc

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

#include "chrome/browser/resource_coordinator/tab_lifecycle_unit.h"

#include <memory>
#include <string>

#include "base/auto_reset.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/webrtc/media_stream_capture_indicator.h"
#include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h"
#include "chrome/browser/notifications/notification_permission_context.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_observer.h"
#include "chrome/browser/resource_coordinator/tab_helper.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_observer.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_unit_external.h"
#include "chrome/browser/resource_coordinator/tab_lifecycle_unit_source.h"
#include "chrome/browser/resource_coordinator/tab_load_tracker.h"
#include "chrome/browser/resource_coordinator/tab_manager_features.h"
#include "chrome/browser/resource_coordinator/test_lifecycle_unit.h"
#include "chrome/browser/resource_coordinator/time.h"
#include "chrome/browser/resource_coordinator/usage_clock.h"
#include "chrome/browser/resource_coordinator/utils.h"
#include "chrome/browser/tab_contents/form_interaction_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h"
#include "chrome/browser/ui/tabs/test_util.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/test_browser_window.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/referrer.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/web_contents_tester.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"

namespace resource_coordinator {

namespace {

LoadingState;

constexpr base::TimeDelta kShortDelay =;

class MockTabLifecycleObserver : public TabLifecycleObserver {};

}  // namespace

class MockLifecycleUnitObserver : public LifecycleUnitObserver {};

class TabLifecycleUnitTest : public ChromeRenderViewHostTestHarness {};

class TabLifecycleUnitTest::ScopedEnterpriseOptOut {};

TEST_F(TabLifecycleUnitTest, AsTabLifecycleUnitExternal) {}

TEST_F(TabLifecycleUnitTest, CanDiscardByDefault) {}

TEST_F(TabLifecycleUnitTest, SetFocused) {}

TEST_F(TabLifecycleUnitTest, AutoDiscardable) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardCrashed) {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(TabLifecycleUnitTest, CannotDiscardActive) {}

TEST_F(TabLifecycleUnitTest, UrgentDiscardProtections) {}
#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

TEST_F(TabLifecycleUnitTest, CannotDiscardInvalidURL) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardEmptyURL) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardVideoCapture) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardHasFormInteractions) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardDesktopCapture) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardRecentlyAudible) {}

TEST_F(TabLifecycleUnitTest, CanDiscardNeverAudibleTab) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardPDF) {}

TEST_F(TabLifecycleUnitTest, NotifiedOfWebContentsVisibilityChanges) {}

TEST_F(TabLifecycleUnitTest, CannotDiscardPictureInPictureWindow) {}

}  // namespace resource_coordinator