chromium/chrome/browser/window_management/window_management_printing_interactive_uitest.cc

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

#include "build/chromeos_buildflags.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/permissions/permission_request_manager.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 "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/display/screen_base.h"
#include "ui/display/test/test_screen.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/shell.h"
#include "ui/display/test/display_manager_test_api.h"  // nogncheck
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

class WindowManagementTest : public InProcessBrowserTest {};

// TODO(crbug.com/40115071): Windows crashes static casting to ScreenWin.
#if BUILDFLAG(IS_WIN)
#define MAYBE_NoCrashOnEventsDuringHandlerPrint
#else
#define MAYBE_NoCrashOnEventsDuringHandlerPrint
#endif
// Test that screen change events occurring while an event handler is running
// a nested event loop (i.e. via window.print()) do not cause a crash.
// Regression test for crbug.com/1273841
IN_PROC_BROWSER_TEST_F(WindowManagementTest,
                       MAYBE_NoCrashOnEventsDuringHandlerPrint) {}