login_screen_test_api.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Copyright 2019 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 ASH_PUBLIC_CPP_LOGIN_SCREEN_TEST_API_H_
  5. #define ASH_PUBLIC_CPP_LOGIN_SCREEN_TEST_API_H_
  6. #include <string>
  7. #include "ash/public/cpp/ash_public_export.h"
  8. #include "ash/public/cpp/login_types.h"
  9. #include "base/callback_forward.h"
  10. #include "ui/base/accelerators/accelerator.h"
  11. #include "ui/gfx/geometry/rect.h"
  12. class AccountId;
  13. namespace ash {
  14. class ASH_PUBLIC_EXPORT LoginScreenTestApi {
  15. public:
  16. LoginScreenTestApi() = delete;
  17. LoginScreenTestApi(const LoginScreenTestApi&) = delete;
  18. LoginScreenTestApi& operator=(const LoginScreenTestApi&) = delete;
  19. static bool IsLockShown();
  20. // Schedules the callback to be run when the LockScreen is shown. Note that
  21. // the LockScreen class is used for both the Lock and the Login screens.
  22. static void AddOnLockScreenShownCallback(
  23. base::OnceClosure on_lock_screen_shown);
  24. static bool IsLoginShelfShown();
  25. static bool IsRestartButtonShown();
  26. static bool IsShutdownButtonShown();
  27. static bool IsAppsButtonShown();
  28. static bool IsAuthErrorBubbleShown();
  29. static bool IsGuestButtonShown();
  30. static bool IsAddUserButtonShown();
  31. static bool IsCancelButtonShown();
  32. static bool IsParentAccessButtonShown();
  33. static bool IsEnterpriseEnrollmentButtonShown();
  34. static bool IsOsInstallButtonShown();
  35. static bool IsWarningBubbleShown();
  36. static bool IsUserAddingScreenIndicatorShown();
  37. static bool IsSystemInfoShown();
  38. static bool IsKioskDefaultMessageShown();
  39. static bool IsKioskInstructionBubbleShown();
  40. static bool IsPasswordFieldShown(const AccountId& account_id);
  41. static bool IsDisplayPasswordButtonShown(const AccountId& account_id);
  42. static bool IsManagedIconShown(const AccountId& account_id);
  43. static bool IsManagedMessageInDialogShown(const AccountId& account_id);
  44. static bool IsForcedOnlineSignin(const AccountId& account_id);
  45. static void SubmitPassword(const AccountId& account_id,
  46. const std::string& password,
  47. bool check_if_submittable);
  48. static std::u16string GetChallengeResponseLabel(const AccountId& account_id);
  49. static bool IsChallengeResponseButtonClickable(const AccountId& account_id);
  50. static void ClickChallengeResponseButton(const AccountId& account_id);
  51. static int64_t GetUiUpdateCount();
  52. static bool LaunchApp(const std::string& app_id);
  53. static bool ClickAppsButton();
  54. static bool ClickAddUserButton();
  55. static bool ClickCancelButton();
  56. static bool ClickGuestButton();
  57. static bool ClickEnterpriseEnrollmentButton();
  58. static bool ClickOsInstallButton();
  59. static bool PressAccelerator(const ui::Accelerator& accelerator);
  60. static bool SendAcceleratorNatively(const ui::Accelerator& accelerator);
  61. static bool WaitForUiUpdate(int64_t previous_update_count);
  62. static int GetUsersCount();
  63. static bool FocusKioskDefaultMessage();
  64. static bool FocusUser(const AccountId& account_id);
  65. static AccountId GetFocusedUser();
  66. static bool RemoveUser(const AccountId& account_id);
  67. static std::string GetDisplayedName(const AccountId& account_id);
  68. static std::u16string GetDisabledAuthMessage(const AccountId& account_id);
  69. static std::u16string GetManagementDisclosureText(
  70. const AccountId& account_id);
  71. static bool ExpandPublicSessionPod(const AccountId& account_id);
  72. static bool HidePublicSessionExpandedPod();
  73. static bool IsPublicSessionExpanded();
  74. static bool IsExpandedPublicSessionAdvanced();
  75. static bool IsPublicSessionWarningShown();
  76. static void ClickPublicExpandedAdvancedViewButton();
  77. static void ClickPublicExpandedSubmitButton();
  78. static void SetPublicSessionLocale(const std::string& locale);
  79. static void SetPublicSessionKeyboard(const std::string& ime_id);
  80. static std::vector<ash::LocaleItem> GetPublicSessionLocales(
  81. const AccountId& account_id);
  82. static std::vector<ash::LocaleItem> GetExpandedPublicSessionLocales();
  83. static std::string GetExpandedPublicSessionSelectedLocale();
  84. static std::string GetExpandedPublicSessionSelectedKeyboard();
  85. static bool IsOobeDialogVisible();
  86. static std::u16string GetShutDownButtonLabel();
  87. static gfx::Rect GetShutDownButtonTargetBounds();
  88. static gfx::Rect GetShutDownButtonMirroredBounds();
  89. static void SetPinRequestWidgetShownCallback(
  90. base::RepeatingClosure on_pin_request_widget_shown);
  91. static std::u16string GetPinRequestWidgetTitle();
  92. static void SubmitPinRequestWidget(const std::string& pin);
  93. static void CancelPinRequestWidget();
  94. };
  95. } // namespace ash
  96. #endif // ASH_PUBLIC_CPP_LOGIN_SCREEN_TEST_API_H_