OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_OZONE_PLATFORM_DRM_TEST_MOCK_DRM_DEVICE_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_TEST_MOCK_DRM_DEVICE_H_ |
6 #define UI_OZONE_PLATFORM_DRM_TEST_MOCK_DRM_DEVICE_H_ | 6 #define UI_OZONE_PLATFORM_DRM_TEST_MOCK_DRM_DEVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "skia/ext/refptr.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
13 #include "third_party/skia/include/core/SkSurface.h" | 13 #include "third_party/skia/include/core/SkSurface.h" |
14 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 14 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 class CrtcController; | 18 class CrtcController; |
19 struct GammaRampRGBEntry; | 19 struct GammaRampRGBEntry; |
20 | 20 |
21 // The real DrmDevice makes actual DRM calls which we can't use in unit tests. | 21 // The real DrmDevice makes actual DRM calls which we can't use in unit tests. |
22 class MockDrmDevice : public ui::DrmDevice { | 22 class MockDrmDevice : public ui::DrmDevice { |
(...skipping 19 matching lines...) Expand all Loading... |
42 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } | 42 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } |
43 void set_add_framebuffer_expectation(bool state) { | 43 void set_add_framebuffer_expectation(bool state) { |
44 add_framebuffer_expectation_ = state; | 44 add_framebuffer_expectation_ = state; |
45 } | 45 } |
46 void set_create_dumb_buffer_expectation(bool state) { | 46 void set_create_dumb_buffer_expectation(bool state) { |
47 create_dumb_buffer_expectation_ = state; | 47 create_dumb_buffer_expectation_ = state; |
48 } | 48 } |
49 | 49 |
50 uint32_t current_framebuffer() const { return current_framebuffer_; } | 50 uint32_t current_framebuffer() const { return current_framebuffer_; } |
51 | 51 |
52 const std::vector<skia::RefPtr<SkSurface>> buffers() const { | 52 const std::vector<sk_sp<SkSurface>> buffers() const { return buffers_; } |
53 return buffers_; | |
54 } | |
55 | 53 |
56 uint32_t get_cursor_handle_for_crtc(uint32_t crtc) const { | 54 uint32_t get_cursor_handle_for_crtc(uint32_t crtc) const { |
57 const auto it = crtc_cursor_map_.find(crtc); | 55 const auto it = crtc_cursor_map_.find(crtc); |
58 return it != crtc_cursor_map_.end() ? it->second : 0; | 56 return it != crtc_cursor_map_.end() ? it->second : 0; |
59 } | 57 } |
60 | 58 |
61 void RunCallbacks(); | 59 void RunCallbacks(); |
62 | 60 |
63 // DrmDevice: | 61 // DrmDevice: |
64 ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) override; | 62 ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) override; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 128 |
131 bool set_crtc_expectation_; | 129 bool set_crtc_expectation_; |
132 bool add_framebuffer_expectation_; | 130 bool add_framebuffer_expectation_; |
133 bool page_flip_expectation_; | 131 bool page_flip_expectation_; |
134 bool create_dumb_buffer_expectation_; | 132 bool create_dumb_buffer_expectation_; |
135 | 133 |
136 bool use_sync_flips_; | 134 bool use_sync_flips_; |
137 | 135 |
138 uint32_t current_framebuffer_; | 136 uint32_t current_framebuffer_; |
139 | 137 |
140 std::vector<skia::RefPtr<SkSurface>> buffers_; | 138 std::vector<sk_sp<SkSurface>> buffers_; |
141 | 139 |
142 std::map<uint32_t, uint32_t> crtc_cursor_map_; | 140 std::map<uint32_t, uint32_t> crtc_cursor_map_; |
143 | 141 |
144 std::queue<PageFlipCallback> callbacks_; | 142 std::queue<PageFlipCallback> callbacks_; |
145 | 143 |
146 DISALLOW_COPY_AND_ASSIGN(MockDrmDevice); | 144 DISALLOW_COPY_AND_ASSIGN(MockDrmDevice); |
147 }; | 145 }; |
148 | 146 |
149 } // namespace ui | 147 } // namespace ui |
150 | 148 |
151 #endif // UI_OZONE_PLATFORM_DRM_TEST_MOCK_DRM_DEVICE_H_ | 149 #endif // UI_OZONE_PLATFORM_DRM_TEST_MOCK_DRM_DEVICE_H_ |
OLD | NEW |