hotseat_state_watcher.h 1009 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (c) 2020 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_SHELF_TEST_HOTSEAT_STATE_WATCHER_H_
  5. #define ASH_SHELF_TEST_HOTSEAT_STATE_WATCHER_H_
  6. #include "ash/shelf/shelf_layout_manager.h"
  7. #include "testing/gtest/include/gtest/gtest.h"
  8. namespace ash {
  9. // Records HotseatState transitions.
  10. class HotseatStateWatcher : public ShelfLayoutManagerObserver {
  11. public:
  12. explicit HotseatStateWatcher(ShelfLayoutManager* shelf_layout_manager);
  13. ~HotseatStateWatcher() override;
  14. void OnHotseatStateChanged(HotseatState old_state,
  15. HotseatState new_state) override;
  16. void CheckEqual(std::vector<HotseatState> state_changes);
  17. void WaitUntilStateChanged();
  18. private:
  19. ShelfLayoutManager* shelf_layout_manager_;
  20. std::vector<HotseatState> state_changes_;
  21. base::RunLoop run_loop_;
  22. };
  23. } // namespace ash
  24. #endif // ASH_SHELF_TEST_HOTSEAT_STATE_WATCHER_H_