blob: f43efe739f646ab8545801422d2efe9be0bf040f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_ANDROID_MOCK_SURFACE_TEXTURE_GL_OWNER_H_
#define MEDIA_GPU_ANDROID_MOCK_SURFACE_TEXTURE_GL_OWNER_H_
#include "media/gpu/android/surface_texture_gl_owner.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
namespace media {
// This is a mock with a small amount of fake functionality too.
class MockSurfaceTextureGLOwner : public SurfaceTextureGLOwner {
public:
MockSurfaceTextureGLOwner(GLuint fake_texture_id,
gl::GLContext* fake_context,
gl::GLSurface* fake_surface);
MOCK_CONST_METHOD0(GetTextureId, GLuint());
MOCK_CONST_METHOD0(GetContext, gl::GLContext*());
MOCK_CONST_METHOD0(GetSurface, gl::GLSurface*());
MOCK_CONST_METHOD0(CreateJavaSurface, gl::ScopedJavaSurface());
MOCK_METHOD0(UpdateTexImage, void());
MOCK_METHOD1(GetTransformMatrix, void(float mtx[16]));
MOCK_METHOD0(ReleaseBackBuffers, void());
MOCK_METHOD0(SetReleaseTimeToNow, void());
MOCK_METHOD0(IgnorePendingRelease, void());
MOCK_METHOD0(IsExpectingFrameAvailable, bool());
MOCK_METHOD0(WaitForFrameAvailable, void());
// Fake implementations that the mocks will call by default.
void FakeSetReleaseTimeToNow() { expecting_frame_available = true; }
void FakeIgnorePendingRelease() { expecting_frame_available = false; }
bool FakeIsExpectingFrameAvailable() { return expecting_frame_available; }
void FakeWaitForFrameAvailable() { expecting_frame_available = false; }
GLuint fake_texture_id;
gl::GLContext* fake_context;
gl::GLSurface* fake_surface;
bool expecting_frame_available;
protected:
~MockSurfaceTextureGLOwner();
};
} // namespace media
#endif // MEDIA_GPU_ANDROID_MOCK_SURFACE_TEXTURE_GL_OWNER_H_
|