blob: a86d348b61c0b06ecca62b534d32924e03cbbceb [file] [log] [blame]
yjliu9edcefd2022-01-25 02:00:331// 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
11namespace exo {
12
13class SurfaceObserverForTest : public SurfaceObserver {
14 public:
15 SurfaceObserverForTest();
16 SurfaceObserverForTest(const SurfaceObserverForTest&) = delete;
17 SurfaceObserverForTest& operator=(const SurfaceObserverForTest&) = delete;
Arthur Eubanksb34721e2022-08-24 17:47:2018 ~SurfaceObserverForTest() override;
yjliu9edcefd2022-01-25 02:00:3319
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_