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

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

Issue 402773002: [Ozone-DRI] Removing MockDriSurface implementation (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>
9
10 #include "skia/ext/refptr.h"
11 #include "third_party/skia/include/core/SkSurface.h"
8 #include "ui/ozone/platform/dri/dri_wrapper.h" 12 #include "ui/ozone/platform/dri/dri_wrapper.h"
9 13
10 namespace ui { 14 namespace ui {
11 15
12 // The real DriWrapper makes actual DRM calls which we can't use in unit tests. 16 // The real DriWrapper makes actual DRM calls which we can't use in unit tests.
13 class MockDriWrapper : public ui::DriWrapper { 17 class MockDriWrapper : public ui::DriWrapper {
14 public: 18 public:
15 MockDriWrapper(int fd); 19 MockDriWrapper(int fd);
16 virtual ~MockDriWrapper(); 20 virtual ~MockDriWrapper();
17 21
18 int get_get_crtc_call_count() const { return get_crtc_call_count_; } 22 int get_get_crtc_call_count() const { return get_crtc_call_count_; }
19 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; } 23 int get_restore_crtc_call_count() const { return restore_crtc_call_count_; }
20 int get_add_framebuffer_call_count() const { 24 int get_add_framebuffer_call_count() const {
21 return add_framebuffer_call_count_; 25 return add_framebuffer_call_count_;
22 } 26 }
23 int get_remove_framebuffer_call_count() const { 27 int get_remove_framebuffer_call_count() const {
24 return remove_framebuffer_call_count_; 28 return remove_framebuffer_call_count_;
25 } 29 }
26 int get_page_flip_call_count() const { return page_flip_call_count_; } 30 int get_page_flip_call_count() const { return page_flip_call_count_; }
27 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; } 31 int get_overlay_flip_call_count() const { return overlay_flip_call_count_; }
28 void fail_init() { fd_ = -1; } 32 void fail_init() { fd_ = -1; }
29 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; } 33 void set_set_crtc_expectation(bool state) { set_crtc_expectation_ = state; }
30 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; } 34 void set_page_flip_expectation(bool state) { page_flip_expectation_ = state; }
31 void set_add_framebuffer_expectation(bool state) { 35 void set_add_framebuffer_expectation(bool state) {
32 add_framebuffer_expectation_ = state; 36 add_framebuffer_expectation_ = state;
33 } 37 }
38 void set_create_dumb_buffer_expectation(bool state) {
39 create_dumb_buffer_expectation_ = state;
40 }
41
42 const std::vector<skia::RefPtr<SkSurface> > buffers() const {
43 return buffers_;
44 }
34 45
35 // DriWrapper: 46 // DriWrapper:
36 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE; 47 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id) OVERRIDE;
37 virtual bool SetCrtc(uint32_t crtc_id, 48 virtual bool SetCrtc(uint32_t crtc_id,
38 uint32_t framebuffer, 49 uint32_t framebuffer,
39 uint32_t* connectors, 50 uint32_t* connectors,
40 drmModeModeInfo* mode) OVERRIDE; 51 drmModeModeInfo* mode) OVERRIDE;
41 virtual bool SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) OVERRIDE; 52 virtual bool SetCrtc(drmModeCrtc* crtc, uint32_t* connectors) OVERRIDE;
42 virtual bool AddFramebuffer(uint32_t width, 53 virtual bool AddFramebuffer(uint32_t width,
43 uint32_t height, 54 uint32_t height,
(...skipping 17 matching lines...) Expand all
61 uint32_t property_id, 72 uint32_t property_id,
62 uint64_t value) OVERRIDE; 73 uint64_t value) OVERRIDE;
63 virtual ScopedDrmPropertyBlobPtr GetPropertyBlob(drmModeConnector* connector, 74 virtual ScopedDrmPropertyBlobPtr GetPropertyBlob(drmModeConnector* connector,
64 const char* name) OVERRIDE; 75 const char* name) OVERRIDE;
65 virtual bool SetCursor(uint32_t crtc_id, 76 virtual bool SetCursor(uint32_t crtc_id,
66 uint32_t handle, 77 uint32_t handle,
67 uint32_t width, 78 uint32_t width,
68 uint32_t height) OVERRIDE; 79 uint32_t height) OVERRIDE;
69 virtual bool MoveCursor(uint32_t crtc_id, int x, int y) OVERRIDE; 80 virtual bool MoveCursor(uint32_t crtc_id, int x, int y) OVERRIDE;
70 virtual void HandleEvent(drmEventContext& event) OVERRIDE; 81 virtual void HandleEvent(drmEventContext& event) OVERRIDE;
82 virtual bool CreateDumbBuffer(const SkImageInfo& info,
83 uint32_t* handle,
84 uint32_t* stride,
85 void** pixels) OVERRIDE;
86 virtual void DestroyDumbBuffer(const SkImageInfo& info,
87 uint32_t handle,
88 uint32_t stride,
89 void* pixels) OVERRIDE;
71 90
72 private: 91 private:
73 int get_crtc_call_count_; 92 int get_crtc_call_count_;
74 int restore_crtc_call_count_; 93 int restore_crtc_call_count_;
75 int add_framebuffer_call_count_; 94 int add_framebuffer_call_count_;
76 int remove_framebuffer_call_count_; 95 int remove_framebuffer_call_count_;
77 int page_flip_call_count_; 96 int page_flip_call_count_;
78 int overlay_flip_call_count_; 97 int overlay_flip_call_count_;
79 98
80 bool set_crtc_expectation_; 99 bool set_crtc_expectation_;
81 bool add_framebuffer_expectation_; 100 bool add_framebuffer_expectation_;
82 bool page_flip_expectation_; 101 bool page_flip_expectation_;
102 bool create_dumb_buffer_expectation_;
103
104 std::vector<skia::RefPtr<SkSurface> > buffers_;
83 105
84 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper); 106 DISALLOW_COPY_AND_ASSIGN(MockDriWrapper);
85 }; 107 };
86 108
87 } // namespace ui 109 } // namespace ui
88 110
89 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_ 111 #endif // UI_OZONE_PLATFORM_DRI_TEST_MOCK_DRI_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698