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_DRI_TEST_MOCK_DRI_WRAPPER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ |
6 #define UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 int get_set_crtc_call_count() const { return set_crtc_call_count_; } | 26 int get_set_crtc_call_count() const { return set_crtc_call_count_; } |
27 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; } | 27 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; } |
28 int get_add_framebuffer_call_count() const { | 28 int get_add_framebuffer_call_count() const { |
29 return add_framebuffer_call_count_; | 29 return add_framebuffer_call_count_; |
30 } | 30 } |
31 int get_remove_framebuffer_call_count() const { | 31 int get_remove_framebuffer_call_count() const { |
32 return remove_framebuffer_call_count_; | 32 return remove_framebuffer_call_count_; |
33 } | 33 } |
34 int get_page_flip_call_count() const { return page_flip_call_count_; } | 34 int get_page_flip_call_count() const { return page_flip_call_count_; } |
35 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } | 35 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } |
| 36 int get_handle_events_count() const { return handle_events_count_; } |
36 void fail_init() { fd_ = -1; } | 37 void fail_init() { fd_ = -1; } |
37 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } | 38 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } |
38 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } | 39 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } |
39 void set_add_framebuffer_expectation(bool state) { | 40 void set_add_framebuffer_expectation(bool state) { |
40 add_framebuffer_expectation_ = state; | 41 add_framebuffer_expectation_ = state; |
41 } | 42 } |
42 void set_create_dumb_buffer_expectation(bool state) { | 43 void set_create_dumb_buffer_expectation(bool state) { |
43 create_dumb_buffer_expectation_ = state; | 44 create_dumb_buffer_expectation_ = state; |
44 } | 45 } |
45 | 46 |
46 uint32_t current_framebuffer() const { return current_framebuffer_; } | 47 uint32_t current_framebuffer() const { return current_framebuffer_; } |
47 | 48 |
48 const std::vector<skia::RefPtr<SkSurface> > buffers() const { | 49 const std::vector<skia::RefPtr<SkSurface> > buffers() const { |
49 return buffers_; | 50 return buffers_; |
50 } | 51 } |
51 | 52 |
| 53 // Overwrite the list of controllers used when serving the PageFlip requests. |
| 54 void set_controllers(const std::queue<CrtcController*>& controllers) { |
| 55 controllers_ = controllers; |
| 56 } |
| 57 |
52 // DriWrapper: | 58 // DriWrapper: |
53 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE; | 59 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE; |
54 virtual bool SetCrtc(uint32_t crtc_id, | 60 virtual bool SetCrtc(uint32_t crtc_id, |
55 uint32_t framebuffer, | 61 uint32_t framebuffer, |
56 std::vector<uint32_t> connectors, | 62 std::vector<uint32_t> connectors, |
57 drmModeModeInfo* mode) OVERRIDE; | 63 drmModeModeInfo* mode) OVERRIDE; |
58 virtual bool SetCrtc(drmModeCrtc* crtc, | 64 virtual bool SetCrtc(drmModeCrtc* crtc, |
59 std::vector<uint32_t> connectors) OVERRIDE; | 65 std::vector<uint32_t> connectors) OVERRIDE; |
60 virtual ScopedDrmConnectorPtr GetConnector(uint32_t connector_id) OVERRIDE; | 66 virtual ScopedDrmConnectorPtr GetConnector(uint32_t connector_id) OVERRIDE; |
61 virtual bool AddFramebuffer(uint32_t width, | 67 virtual bool AddFramebuffer(uint32_t width, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void* pixels) OVERRIDE; | 102 void* pixels) OVERRIDE; |
97 | 103 |
98 private: | 104 private: |
99 int get_crtc_call_count_; | 105 int get_crtc_call_count_; |
100 int set_crtc_call_count_; | 106 int set_crtc_call_count_; |
101 int restore_crtc_call_count_; | 107 int restore_crtc_call_count_; |
102 int add_framebuffer_call_count_; | 108 int add_framebuffer_call_count_; |
103 int remove_framebuffer_call_count_; | 109 int remove_framebuffer_call_count_; |
104 int page_flip_call_count_; | 110 int page_flip_call_count_; |
105 int overlay_flip_call_count_; | 111 int overlay_flip_call_count_; |
| 112 int handle_events_count_; |
106 | 113 |
107 bool set_crtc_expectation_; | 114 bool set_crtc_expectation_; |
108 bool add_framebuffer_expectation_; | 115 bool add_framebuffer_expectation_; |
109 bool page_flip_expectation_; | 116 bool page_flip_expectation_; |
110 bool create_dumb_buffer_expectation_; | 117 bool create_dumb_buffer_expectation_; |
111 | 118 |
112 uint32_t current_framebuffer_; | 119 uint32_t current_framebuffer_; |
113 | 120 |
114 std::vector<skia::RefPtr<SkSurface> > buffers_; | 121 std::vector<skia::RefPtr<SkSurface> > buffers_; |
115 | 122 |
116 std::queue<CrtcController*> controllers_; | 123 std::queue<CrtcController*> controllers_; |
117 | 124 |
118 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper); | 125 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper); |
119 }; | 126 }; |
120 | 127 |
121 } // namespace ui | 128 } // namespace ui |
122 | 129 |
123 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ | 130 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ |
OLD | NEW |