surface_test_util.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 COMPONENTS_EXO_SURFACE_TEST_UTIL_H_
  5. #define COMPONENTS_EXO_SURFACE_TEST_UTIL_H_
  6. #include "components/exo/surface_observer.h"
  7. #include "testing/gmock/include/gmock/gmock.h"
  8. namespace exo {
  9. class SurfaceObserverForTest : public SurfaceObserver {
  10. public:
  11. SurfaceObserverForTest();
  12. SurfaceObserverForTest(const SurfaceObserverForTest&) = delete;
  13. SurfaceObserverForTest& operator=(const SurfaceObserverForTest&) = delete;
  14. virtual ~SurfaceObserverForTest();
  15. // SurfaceObserver overrides
  16. void OnSurfaceDestroying(Surface* surface) override {}
  17. void OnWindowOcclusionChanged(Surface* surface) override {
  18. num_occlusion_changes_++;
  19. }
  20. int num_occlusion_changes() const { return num_occlusion_changes_; }
  21. MOCK_METHOD(void, ThrottleFrameRate, (bool on), (override));
  22. private:
  23. int num_occlusion_changes_ = 0;
  24. };
  25. } // namespace exo
  26. #endif // COMPONENTS_EXO_SURFACE_TEST_UTIL_H_