fake_linux_ui.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_LINUX_FAKE_LINUX_UI_H_
  5. #define UI_LINUX_FAKE_LINUX_UI_H_
  6. #include "ui/linux/linux_ui_base.h"
  7. namespace ui {
  8. // This class is meant to be overridden by tests. It's provided as a
  9. // convenience so that tests don't have to stub lots of methods just to override
  10. // a single one.
  11. class FakeLinuxUi : public LinuxUiBase {
  12. public:
  13. FakeLinuxUi();
  14. ~FakeLinuxUi() override;
  15. std::unique_ptr<ui::LinuxInputMethodContext> CreateInputMethodContext(
  16. ui::LinuxInputMethodContextDelegate* delegate) const override;
  17. gfx::FontRenderParams GetDefaultFontRenderParams() const override;
  18. void GetDefaultFontDescription(
  19. std::string* family_out,
  20. int* size_pixels_out,
  21. int* style_out,
  22. int* weight_out,
  23. gfx::FontRenderParams* params_out) const override;
  24. ui::SelectFileDialog* CreateSelectFileDialog(
  25. void* listener,
  26. std::unique_ptr<ui::SelectFilePolicy> policy) const override;
  27. bool Initialize() override;
  28. bool GetColor(int id, SkColor* color, bool use_custom_frame) const override;
  29. bool GetDisplayProperty(int id, int* result) const override;
  30. SkColor GetFocusRingColor() const override;
  31. SkColor GetActiveSelectionBgColor() const override;
  32. SkColor GetActiveSelectionFgColor() const override;
  33. SkColor GetInactiveSelectionBgColor() const override;
  34. SkColor GetInactiveSelectionFgColor() const override;
  35. base::TimeDelta GetCursorBlinkInterval() const override;
  36. gfx::Image GetIconForContentType(const std::string& content_type,
  37. int size,
  38. float scale) const override;
  39. WindowFrameAction GetWindowFrameAction(
  40. WindowFrameActionSource source) override;
  41. float GetDeviceScaleFactor() const override;
  42. bool PreferDarkTheme() const override;
  43. bool AnimationsEnabled() const override;
  44. std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
  45. ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame) override;
  46. base::flat_map<std::string, std::string> GetKeyboardLayoutMap() override;
  47. std::string GetCursorThemeName() override;
  48. int GetCursorThemeSize() override;
  49. ui::NativeTheme* GetNativeThemeImpl() const override;
  50. bool GetTextEditCommandsForEvent(
  51. const ui::Event& event,
  52. std::vector<ui::TextEditCommandAuraLinux>* commands) override;
  53. #if BUILDFLAG(ENABLE_PRINTING)
  54. printing::PrintDialogLinuxInterface* CreatePrintDialog(
  55. printing::PrintingContextLinux* context) override;
  56. gfx::Size GetPdfPaperSize(printing::PrintingContextLinux* context) override;
  57. #endif
  58. };
  59. } // namespace ui
  60. #endif // UI_LINUX_FAKE_LINUX_UI_H_