test_lock_screen_action_background_controller.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2017 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_LOCK_SCREEN_ACTION_TEST_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
  5. #define ASH_LOCK_SCREEN_ACTION_TEST_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ash/lock_screen_action/lock_screen_action_background_controller.h"
  9. namespace aura {
  10. class Window;
  11. }
  12. namespace views {
  13. class Widget;
  14. }
  15. namespace ash {
  16. // Testing implementation of LockScreenActionBackgroundController.
  17. // This implementation uses a window (if created at all) that does not animate
  18. // visibility. When |ShowBackground| and |HideBackground| methods are called,
  19. // the controller will transition to kShowing and kHiding states. The tests
  20. // should use |FinishShow| and |FinishHide| to complete visibility transitions.
  21. class ASH_EXPORT TestLockScreenActionBackgroundController
  22. : public LockScreenActionBackgroundController {
  23. public:
  24. TestLockScreenActionBackgroundController();
  25. TestLockScreenActionBackgroundController(
  26. const TestLockScreenActionBackgroundController&) = delete;
  27. TestLockScreenActionBackgroundController& operator=(
  28. const TestLockScreenActionBackgroundController&) = delete;
  29. ~TestLockScreenActionBackgroundController() override;
  30. // LockScreenBackgroundController:
  31. bool IsBackgroundWindow(aura::Window* window) const override;
  32. bool ShowBackground() override;
  33. bool HideBackgroundImmediately() override;
  34. bool HideBackground() override;
  35. // If the controller is in kShowing state, updates state to kShown.
  36. // Returns whether the state has changed.
  37. bool FinishShow();
  38. // If the controller is in kHiding state, updates state to kHidden, and hides
  39. // testing window is a window was created.
  40. // Returns whether the state has changed.
  41. bool FinishHide();
  42. // Gets the testing window, if one was created.
  43. aura::Window* GetWindow() const;
  44. private:
  45. // Testing widget created when the background is shown.
  46. std::unique_ptr<views::Widget> widget_;
  47. };
  48. } // namespace ash
  49. #endif // ASH_LOCK_SCREEN_ACTION_TEST_LOCK_SCREEN_ACTION_BACKGROUND_CONTROLLER_H_