chromium/chrome/test/data/webui/print_preview/print_preview_focus_test.cc

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

#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/web_ui_mocha_browser_test.h"
#include "content/public/test/browser_test.h"

class PrintPreviewFocusTest : public WebUIMochaFocusTest {};

// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256
#if BUILDFLAG(IS_WIN)
#define MAYBE_FocusPrintButtonOnReady
#else
#define MAYBE_FocusPrintButtonOnReady
#endif
IN_PROC_BROWSER_TEST_F(PrintPreviewFocusTest, MAYBE_FocusPrintButtonOnReady) {}

IN_PROC_BROWSER_TEST_F(PrintPreviewFocusTest, BlurResetsEmptyNumberInput) {}

// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256
#if BUILDFLAG(IS_WIN)
#define MAYBE_AutoFocusScalingInput
#else
#define MAYBE_AutoFocusScalingInput
#endif
IN_PROC_BROWSER_TEST_F(PrintPreviewFocusTest, MAYBE_AutoFocusScalingInput) {}

class PrintPreviewPagesSettingsFocusTest : public PrintPreviewFocusTest {};

IN_PROC_BROWSER_TEST_F(PrintPreviewPagesSettingsFocusTest, ClearInput) {}

IN_PROC_BROWSER_TEST_F(PrintPreviewPagesSettingsFocusTest,
                       InputNotDisabledOnValidityChange) {}

IN_PROC_BROWSER_TEST_F(PrintPreviewPagesSettingsFocusTest,
                       EnterOnInputTriggersPrint) {}

#if BUILDFLAG(IS_CHROMEOS)
class PrintPreviewDestinationDropdownCrosFocusTest
    : public PrintPreviewFocusTest {
 protected:
  void RunTestCase(const std::string& testCase) {
    PrintPreviewFocusTest::RunTest(
        "print_preview/destination_dropdown_cros_test.js",
        base::StringPrintf("runMochaTest('DestinationDropdownCrosTest', '%s');",
                           testCase.c_str()));
  }
};

IN_PROC_BROWSER_TEST_F(PrintPreviewDestinationDropdownCrosFocusTest,
                       ClickCloses) {
  RunTestCase("ClickCloses");
}
#endif

class PrintPreviewDestinationDialogFocusTest : public PrintPreviewFocusTest {};

IN_PROC_BROWSER_TEST_F(PrintPreviewDestinationDialogFocusTest, FocusSearchBox) {}

IN_PROC_BROWSER_TEST_F(PrintPreviewDestinationDialogFocusTest,
                       EscapeSearchBox) {}