[go: nahoru, domu]

blob: 45983f4880ca67643baa7c408399a9dfe61707e5 [file] [log] [blame]
Chris Watkins05681d392017-06-01 18:53:071// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Eric Karl0ec495062019-09-10 18:40:155#ifndef GPU_COMMAND_BUFFER_SERVICE_MOCK_TEXTURE_OWNER_H_
6#define GPU_COMMAND_BUFFER_SERVICE_MOCK_TEXTURE_OWNER_H_
Chris Watkins05681d392017-06-01 18:53:077
Vikas Sonib729ade2019-01-24 21:40:118#include <memory>
9
10#include "base/android/scoped_hardware_buffer_fence_sync.h"
Eric Karl0ec495062019-09-10 18:40:1511#include "gpu/command_buffer/service/texture_owner.h"
Chris Watkins05681d392017-06-01 18:53:0712#include "testing/gmock/include/gmock/gmock.h"
13#include "testing/gtest/include/gtest/gtest.h"
Chris Watkinsa60f5b12017-06-02 19:15:3314#include "ui/gl/gl_bindings.h"
15#include "ui/gl/gl_context.h"
16#include "ui/gl/gl_surface.h"
Chris Watkins05681d392017-06-01 18:53:0717
Vikas Soni0cd28d92019-08-01 18:57:5918using testing::NiceMock;
19
Vikas Soniaa04e982019-08-16 20:57:0820namespace gpu {
Chris Watkins05681d392017-06-01 18:53:0721
Chris Watkinsa60f5b12017-06-02 19:15:3322// This is a mock with a small amount of fake functionality too.
Vikas Sonie5eda882018-05-08 18:30:5823class MockTextureOwner : public TextureOwner {
Chris Watkins05681d392017-06-01 18:53:0724 public:
Vikas Sonie5eda882018-05-08 18:30:5825 MockTextureOwner(GLuint fake_texture_id,
26 gl::GLContext* fake_context,
Khushale2d9fa32019-03-08 00:02:1427 gl::GLSurface* fake_surface,
28 bool binds_texture_on_update = false);
Chris Watkinsa60f5b12017-06-02 19:15:3329
Chris Watkins05681d392017-06-01 18:53:0730 MOCK_CONST_METHOD0(GetTextureId, GLuint());
31 MOCK_CONST_METHOD0(GetContext, gl::GLContext*());
32 MOCK_CONST_METHOD0(GetSurface, gl::GLSurface*());
33 MOCK_CONST_METHOD0(CreateJavaSurface, gl::ScopedJavaSurface());
Khushale2d9fa32019-03-08 00:02:1434 MOCK_METHOD0(UpdateTexImage, void());
35 MOCK_METHOD0(EnsureTexImageBound, void());
Chris Watkins05681d392017-06-01 18:53:0736 MOCK_METHOD0(ReleaseBackBuffers, void());
liberato@chromium.orgc3214782018-12-19 22:27:1037 MOCK_METHOD1(OnTextureDestroyed, void(gpu::gles2::AbstractTexture*));
Vikas Soni0cd28d92019-08-01 18:57:5938 MOCK_METHOD1(SetFrameAvailableCallback, void(const base::RepeatingClosure&));
Vasiliy Telezhnikovf3b4d4e2020-05-08 23:33:3439 MOCK_METHOD3(GetCodedSizeAndVisibleRect,
Vasiliy Telezhnikov605f7fe32020-07-31 22:40:0940 bool(gfx::Size rotated_visible_size,
Vasiliy Telezhnikovf3b4d4e2020-05-08 23:33:3441 gfx::Size* coded_size,
42 gfx::Rect* visible_rect));
Vasiliy Telezhnikovc9e34c62020-12-01 14:40:0143 MOCK_METHOD1(RunWhenBufferIsAvailable, void(base::OnceClosure));
Chris Watkins05681d392017-06-01 18:53:0744
Vikas Sonib729ade2019-01-24 21:40:1145 std::unique_ptr<base::android::ScopedHardwareBufferFenceSync>
46 GetAHardwareBuffer() override {
Khushala55414a2018-10-09 17:13:5347 get_a_hardware_buffer_count++;
48 return nullptr;
49 }
50
Chris Watkinsa60f5b12017-06-02 19:15:3351 gl::GLContext* fake_context;
52 gl::GLSurface* fake_surface;
Khushala55414a2018-10-09 17:13:5353 int get_a_hardware_buffer_count = 0;
Khushale2d9fa32019-03-08 00:02:1454 bool expect_update_tex_image;
Chris Watkinsa60f5b12017-06-02 19:15:3355
Chris Watkins05681d392017-06-01 18:53:0756 protected:
Vikas Sonie5eda882018-05-08 18:30:5857 ~MockTextureOwner();
Chris Watkins05681d392017-06-01 18:53:0758};
59
Vikas Soniaa04e982019-08-16 20:57:0860} // namespace gpu
Chris Watkins05681d392017-06-01 18:53:0761
Eric Karl0ec495062019-09-10 18:40:1562#endif // GPU_COMMAND_BUFFER_SERVICE_MOCK_TEXTURE_OWNER_H_