#include "extensions/browser/api/offscreen/offscreen_document_manager.h"
#include "base/test/bind.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/api/offscreen/lifetime_enforcer_factories.h"
#include "extensions/browser/api/offscreen/offscreen_document_lifetime_enforcer.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_host_test_helper.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/offscreen_document_host.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/api/offscreen.h"
#include "extensions/common/mojom/view_type.mojom.h"
#include "extensions/common/switches.h"
#include "extensions/test/test_extension_dir.h"
namespace extensions {
namespace {
class TestLifetimeEnforcer : public OffscreenDocumentLifetimeEnforcer { … };
std::unique_ptr<OffscreenDocumentLifetimeEnforcer> CreateTestLifetimeEnforcer(
TestLifetimeEnforcer** lifetime_enforcer_out,
OffscreenDocumentHost* offscreen_document,
OffscreenDocumentLifetimeEnforcer::TerminationCallback termination_callback,
OffscreenDocumentLifetimeEnforcer::NotifyInactiveCallback
notify_inactive_callback) { … }
}
class OffscreenDocumentManagerBrowserTest : public ExtensionApiTest { … };
IN_PROC_BROWSER_TEST_F(OffscreenDocumentManagerBrowserTest,
CreateOffscreenDocument) { … }
IN_PROC_BROWSER_TEST_F(OffscreenDocumentManagerBrowserTest,
IncognitoOffscreenDocuments) { … }
IN_PROC_BROWSER_TEST_F(OffscreenDocumentManagerBrowserTest,
ClosingDocumentThroughTheManager) { … }
IN_PROC_BROWSER_TEST_F(OffscreenDocumentManagerBrowserTest,
CallingWindowCloseInAnOffscreenDocumentClosesIt) { … }
IN_PROC_BROWSER_TEST_F(OffscreenDocumentManagerBrowserTest,
LifetimeEnforcement_Terminate) { … }
IN_PROC_BROWSER_TEST_F(OffscreenDocumentManagerBrowserTest,
LifetimeEnforcement_NotifyInactive) { … }
IN_PROC_BROWSER_TEST_F(
OffscreenDocumentManagerBrowserTest,
LifetimeEnforcement_DocumentIsNotTerminatedUntilAllInactive) { … }
}