Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/ozone/platform/dri/test/mock_dri_wrapper.h

Issue 393233005: [Ozone-DRI] Convert HardwareDisplayController to use scanout buffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "skia/ext/refptr.h" 10 #include "skia/ext/refptr.h"
11 #include "third_party/skia/include/core/SkSurface.h" 11 #include "third_party/skia/include/core/SkSurface.h"
12 #include "ui/ozone/platform/dri/dri_wrapper.h" 12 #include "ui/ozone/platform/dri/dri_wrapper.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 class HardwareDisplayController;
17
16 // The real DriWrapper makes actual DRM calls which we can't use in unit tests. 18 // The real DriWrapper makes actual DRM calls which we can't use in unit tests.
17 class MockDriWrapper : public ui::DriWrapper { 19 class MockDriWrapper : public ui::DriWrapper {
18 public: 20 public:
19 MockDriWrapper(int fd); 21 MockDriWrapper(int fd);
20 virtual ~MockDriWrapper(); 22 virtual ~MockDriWrapper();
21 23
22 int get_get_crtc_call_count() const { return get_crtc_call_count_; } 24 int get_get_crtc_call_count() const { return get_crtc_call_count_; }
23 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; } 25 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; }
24 int get_add_framebuffer_call_count() const { 26 int get_add_framebuffer_call_count() const {
25 return add_framebuffer_call_count_; 27 return add_framebuffer_call_count_;
26 } 28 }
27 int get_remove_framebuffer_call_count() const { 29 int get_remove_framebuffer_call_count() const {
28 return remove_framebuffer_call_count_; 30 return remove_framebuffer_call_count_;
29 } 31 }
30 int get_page_flip_call_count() const { return page_flip_call_count_; } 32 int get_page_flip_call_count() const { return page_flip_call_count_; }
31 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } 33 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; }
32 void fail_init() { fd_ = -1; } 34 void fail_init() { fd_ = -1; }
33 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } 35 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; }
34 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } 36 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; }
35 void set_add_framebuffer_expectation(bool state) { 37 void set_add_framebuffer_expectation(bool state) {
36 add_framebuffer_expectation_ = state; 38 add_framebuffer_expectation_ = state;
37 } 39 }
38 void set_create_dumb_buffer_expectation(bool state) { 40 void set_create_dumb_buffer_expectation(bool state) {
39 create_dumb_buffer_expectation_ = state; 41 create_dumb_buffer_expectation_ = state;
40 } 42 }
41 43
44 uint32_t current_framebuffer() const { return current_framebuffer_; }
45
42 const std::vector<skia::RefPtr<SkSurface> > buffers() const { 46 const std::vector<skia::RefPtr<SkSurface> > buffers() const {
43 return buffers_; 47 return buffers_;
44 } 48 }
45 49
46 // DriWrapper: 50 // DriWrapper:
47 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE; 51 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE;
48 virtual bool SetCrtc(uint32_t crtc_id, 52 virtual bool SetCrtc(uint32_t crtc_id,
49 uint32_t framebuffer, 53 uint32_t framebuffer,
50 uint32_t* connectors, 54 uint32_t* connectors,
51 drmModeModeInfo* mode) OVERRIDE; 55 drmModeModeInfo* mode) OVERRIDE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 int add_framebuffer_call_count_; 97 int add_framebuffer_call_count_;
94 int remove_framebuffer_call_count_; 98 int remove_framebuffer_call_count_;
95 int page_flip_call_count_; 99 int page_flip_call_count_;
96 int overlay_flip_call_count_; 100 int overlay_flip_call_count_;
97 101
98 bool set_crtc_expectation_; 102 bool set_crtc_expectation_;
99 bool add_framebuffer_expectation_; 103 bool add_framebuffer_expectation_;
100 bool page_flip_expectation_; 104 bool page_flip_expectation_;
101 bool create_dumb_buffer_expectation_; 105 bool create_dumb_buffer_expectation_;
102 106
107 uint32_t current_framebuffer_;
108
103 std::vector<skia::RefPtr<SkSurface> > buffers_; 109 std::vector<skia::RefPtr<SkSurface> > buffers_;
104 110
111 HardwareDisplayController* controller_;
112
105 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper); 113 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
106 }; 114 };
107 115
108 } // namespace ui 116 } // namespace ui
109 117
110 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ 118 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/screen_manager_unittest.cc ('k') | ui/ozone/platform/dri/test/mock_dri_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698