OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/surfaces/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_output_surface.h" |
6 | 6 |
7 #include "cc/surfaces/onscreen_display_client.h" | 7 #include "cc/surfaces/onscreen_display_client.h" |
8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
9 #include "cc/surfaces/surface_manager.h" | 9 #include "cc/surfaces/surface_manager.h" |
10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 FakeOutputSurface* output_surface() { return fake_output_surface_; } | 41 FakeOutputSurface* output_surface() { return fake_output_surface_; } |
42 | 42 |
43 protected: | 43 protected: |
44 FakeOutputSurface* fake_output_surface_; | 44 FakeOutputSurface* fake_output_surface_; |
45 }; | 45 }; |
46 | 46 |
47 class SurfaceDisplayOutputSurfaceTest : public testing::Test { | 47 class SurfaceDisplayOutputSurfaceTest : public testing::Test { |
48 public: | 48 public: |
49 SurfaceDisplayOutputSurfaceTest() | 49 SurfaceDisplayOutputSurfaceTest() |
50 : task_runner_(new OrderedSimpleTaskRunner()), | 50 : now_src_(new base::SimpleTestTickClock()), |
| 51 task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)), |
51 allocator_(0), | 52 allocator_(0), |
52 display_size_(1920, 1080), | 53 display_size_(1920, 1080), |
53 display_rect_(display_size_), | 54 display_rect_(display_size_), |
54 display_client_(&surface_manager_, | 55 display_client_(&surface_manager_, |
55 &bitmap_manager_, | 56 &bitmap_manager_, |
56 &gpu_memory_buffer_manager_, | 57 &gpu_memory_buffer_manager_, |
57 renderer_settings_, | 58 renderer_settings_, |
58 task_runner_), | 59 task_runner_), |
59 context_provider_(TestContextProvider::Create()), | 60 context_provider_(TestContextProvider::Create()), |
60 surface_display_output_surface_(&surface_manager_, | 61 surface_display_output_surface_(&surface_manager_, |
(...skipping 30 matching lines...) Expand all Loading... |
91 void SetUp() override { | 92 void SetUp() override { |
92 // Draw the first frame to start in an "unlocked" state. | 93 // Draw the first frame to start in an "unlocked" state. |
93 SwapBuffersWithDamage(display_rect_); | 94 SwapBuffersWithDamage(display_rect_); |
94 | 95 |
95 EXPECT_EQ(0u, output_surface_->num_sent_frames()); | 96 EXPECT_EQ(0u, output_surface_->num_sent_frames()); |
96 task_runner_->RunUntilIdle(); | 97 task_runner_->RunUntilIdle(); |
97 EXPECT_EQ(1u, output_surface_->num_sent_frames()); | 98 EXPECT_EQ(1u, output_surface_->num_sent_frames()); |
98 } | 99 } |
99 | 100 |
100 protected: | 101 protected: |
| 102 scoped_ptr<base::SimpleTestTickClock> now_src_; |
101 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; | 103 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; |
102 SurfaceIdAllocator allocator_; | 104 SurfaceIdAllocator allocator_; |
103 | 105 |
104 const gfx::Size display_size_; | 106 const gfx::Size display_size_; |
105 const gfx::Rect display_rect_; | 107 const gfx::Rect display_rect_; |
106 FakeOutputSurface* output_surface_; | 108 FakeOutputSurface* output_surface_; |
107 SurfaceManager surface_manager_; | 109 SurfaceManager surface_manager_; |
108 TestSharedBitmapManager bitmap_manager_; | 110 TestSharedBitmapManager bitmap_manager_; |
109 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 111 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
110 RendererSettings renderer_settings_; | 112 RendererSettings renderer_settings_; |
(...skipping 27 matching lines...) Expand all Loading... |
138 EXPECT_EQ(1u, output_surface_->num_sent_frames()); | 140 EXPECT_EQ(1u, output_surface_->num_sent_frames()); |
139 | 141 |
140 SwapBuffersWithDamage(gfx::Rect()); | 142 SwapBuffersWithDamage(gfx::Rect()); |
141 EXPECT_EQ(1u, output_surface_->num_sent_frames()); | 143 EXPECT_EQ(1u, output_surface_->num_sent_frames()); |
142 task_runner_->RunUntilIdle(); | 144 task_runner_->RunUntilIdle(); |
143 EXPECT_EQ(1u, output_surface_->num_sent_frames()); | 145 EXPECT_EQ(1u, output_surface_->num_sent_frames()); |
144 } | 146 } |
145 | 147 |
146 } // namespace | 148 } // namespace |
147 } // namespace cc | 149 } // namespace cc |
OLD | NEW |