system_tray_test_api.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_SYSTEM_TRAY_TEST_API_H_
  5. #define ASH_PUBLIC_CPP_SYSTEM_TRAY_TEST_API_H_
  6. #include <memory>
  7. #include <string>
  8. #include "ash/ash_export.h"
  9. namespace message_center {
  10. class MessagePopupView;
  11. }
  12. namespace ash {
  13. // Public test API for the system tray. Methods only apply to the system tray
  14. // on the primary display.
  15. class ASH_EXPORT SystemTrayTestApi {
  16. public:
  17. static std::unique_ptr<SystemTrayTestApi> Create();
  18. SystemTrayTestApi();
  19. ~SystemTrayTestApi();
  20. // Returns true if the system tray bubble menu is open.
  21. bool IsTrayBubbleOpen();
  22. // Returns true if the system tray bubble menu is expanded.
  23. bool IsTrayBubbleExpanded();
  24. // Shows the system tray bubble menu.
  25. void ShowBubble();
  26. // Closes the system tray bubble menu.
  27. void CloseBubble();
  28. // Collapse the system tray bubble menu.
  29. void CollapseBubble();
  30. // Expand the system tray bubble menu.
  31. void ExpandBubble();
  32. // Shows the submenu view for the given section of the bubble menu.
  33. void ShowAccessibilityDetailedView();
  34. void ShowNetworkDetailedView();
  35. // Returns true if the view exists in the bubble and is visible.
  36. // If |open_tray| is true, it also opens system tray bubble.
  37. bool IsBubbleViewVisible(int view_id, bool open_tray);
  38. // Clicks the view |view_id|.
  39. void ClickBubbleView(int view_id);
  40. // Returns the tooltip for a bubble view, or the empty string if the view
  41. // does not exist.
  42. std::u16string GetBubbleViewTooltip(int view_id);
  43. // Returns the text for a bubble view, or the empty string if the view
  44. // does not exist. This method only works if the bubble view is a label.
  45. std::u16string GetBubbleViewText(int view_id);
  46. // Get the notification pop up view based on the notification id.
  47. message_center::MessagePopupView* GetPopupViewForNotificationID(
  48. const std::string& notification_id);
  49. // Returns true if the clock is using 24 hour time.
  50. bool Is24HourClock();
  51. // Taps on the Select-to-Speak tray.
  52. void TapSelectToSpeakTray();
  53. };
  54. } // namespace ash
  55. #endif // ASH_PUBLIC_CPP_SYSTEM_TRAY_TEST_API_H_