OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/compositor/gpu_vsync_begin_frame_source.h" | 5 #include "content/browser/compositor/gpu_vsync_begin_frame_source.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 namespace { | 11 namespace { |
12 | 12 |
13 class TestBeginFrameObserver : public cc::BeginFrameObserverBase { | 13 class TestBeginFrameObserver : public cc::BeginFrameObserverBase { |
14 public: | 14 public: |
15 TestBeginFrameObserver() = default; | 15 TestBeginFrameObserver() = default; |
16 | 16 |
17 int begin_frame_count() { return begin_frame_count_; } | 17 int begin_frame_count() { return begin_frame_count_; } |
18 | 18 |
19 private: | 19 private: |
20 bool OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) override { | 20 bool OnBeginFrameDerivedImpl(const cc::BeginFrameArgs& args) override { |
21 begin_frame_count_++; | 21 begin_frame_count_++; |
22 return true; | 22 return true; |
23 } | 23 } |
24 | 24 |
25 void OnBeginFrameSourcePausedChanged(bool paused) override {}; | 25 void OnBeginFrameSourcePausedChanged(bool paused) override {} |
26 | 26 |
27 int begin_frame_count_ = 0; | 27 int begin_frame_count_ = 0; |
28 | 28 |
29 DISALLOW_COPY_AND_ASSIGN(TestBeginFrameObserver); | 29 DISALLOW_COPY_AND_ASSIGN(TestBeginFrameObserver); |
30 }; | 30 }; |
31 | 31 |
32 class TestGpuVSyncBeginFrameSource : public GpuVSyncBeginFrameSource { | 32 class TestGpuVSyncBeginFrameSource : public GpuVSyncBeginFrameSource { |
33 public: | 33 public: |
34 explicit TestGpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control) | 34 explicit TestGpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control) |
35 : GpuVSyncBeginFrameSource(vsync_control) {} | 35 : GpuVSyncBeginFrameSource(vsync_control) {} |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Adding and removing the second observer shouldn't produce any | 176 // Adding and removing the second observer shouldn't produce any |
177 // new notifications. | 177 // new notifications. |
178 begin_frame_source.RemoveObserver(&observer2); | 178 begin_frame_source.RemoveObserver(&observer2); |
179 begin_frame_source.AddObserver(&observer2); | 179 begin_frame_source.AddObserver(&observer2); |
180 | 180 |
181 EXPECT_EQ(1, observer2.begin_frame_count()); | 181 EXPECT_EQ(1, observer2.begin_frame_count()); |
182 } | 182 } |
183 | 183 |
184 } // namespace | 184 } // namespace |
185 } // namespace content | 185 } // namespace content |
OLD | NEW |