yjliu | 9edcefd | 2022-01-25 02:00:33 | [diff] [blame] | 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 | |
| 5 | #ifndef COMPONENTS_EXO_SURFACE_TEST_UTIL_H_ |
| 6 | #define COMPONENTS_EXO_SURFACE_TEST_UTIL_H_ |
| 7 | |
| 8 | #include "components/exo/surface_observer.h" |
| 9 | #include "testing/gmock/include/gmock/gmock.h" |
| 10 | |
| 11 | namespace exo { |
| 12 | |
| 13 | class SurfaceObserverForTest : public SurfaceObserver { |
| 14 | public: |
| 15 | SurfaceObserverForTest(); |
| 16 | SurfaceObserverForTest(const SurfaceObserverForTest&) = delete; |
| 17 | SurfaceObserverForTest& operator=(const SurfaceObserverForTest&) = delete; |
Arthur Eubanks | b34721e | 2022-08-24 17:47:20 | [diff] [blame^] | 18 | ~SurfaceObserverForTest() override; |
yjliu | 9edcefd | 2022-01-25 02:00:33 | [diff] [blame] | 19 | |
| 20 | // SurfaceObserver overrides |
| 21 | void OnSurfaceDestroying(Surface* surface) override {} |
| 22 | |
| 23 | void OnWindowOcclusionChanged(Surface* surface) override { |
| 24 | num_occlusion_changes_++; |
| 25 | } |
| 26 | |
| 27 | int num_occlusion_changes() const { return num_occlusion_changes_; } |
| 28 | |
| 29 | MOCK_METHOD(void, ThrottleFrameRate, (bool on), (override)); |
| 30 | |
| 31 | private: |
| 32 | int num_occlusion_changes_ = 0; |
| 33 | }; |
| 34 | |
| 35 | } // namespace exo |
| 36 | |
| 37 | #endif // COMPONENTS_EXO_SURFACE_TEST_UTIL_H_ |