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

Unified Diff: media/renderers/skcanvas_video_renderer_unittest.cc

Issue 1819663002: Bind GrContext to GLES2Interfaces in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@function
Patch Set: Minimal GetString impl for TestGLES2Interface in skcanvas_video_renderer_unittest.cc Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/media.gyp ('k') | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/skcanvas_video_renderer_unittest.cc
diff --git a/media/renderers/skcanvas_video_renderer_unittest.cc b/media/renderers/skcanvas_video_renderer_unittest.cc
index df82f2740e2a9ec0cf1a1323035d7d117ee48c9c..8d949a83605102485fa5204def7a73b4c9ef1fd7 100644
--- a/media/renderers/skcanvas_video_renderer_unittest.cc
+++ b/media/renderers/skcanvas_video_renderer_unittest.cc
@@ -8,6 +8,7 @@
#include "base/message_loop/message_loop.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface_stub.h"
+#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_frame.h"
#include "media/base/video_util.h"
@@ -512,6 +513,18 @@ class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub {
DCHECK_EQ(1, n);
*textures = 1;
}
+ const GLubyte* GetString(GLenum name) override {
+ switch (name) {
+ case GL_EXTENSIONS:
+ return reinterpret_cast<const GLubyte*>("");
+ case GL_SHADING_LANGUAGE_VERSION:
+ return reinterpret_cast<const GLubyte*>("OpenGL ES GLSL ES 1.00");
+ case GL_VERSION:
+ return reinterpret_cast<const GLubyte*>("OpenGL ES 2.0");
+ default:
+ return nullptr;
+ }
+ }
};
void MailboxHoldersReleased(const gpu::SyncToken& sync_token) {}
} // namespace
@@ -519,16 +532,17 @@ void MailboxHoldersReleased(const gpu::SyncToken& sync_token) {}
// Test that SkCanvasVideoRendererTest::Paint doesn't crash when GrContext is
// abandoned.
TEST_F(SkCanvasVideoRendererTest, ContextLost) {
- skia::RefPtr<const GrGLInterface> null_interface =
- skia::AdoptRef(GrGLCreateNullInterface());
+ SkCanvas canvas(AllocBitmap(kWidth, kHeight));
+
+ TestGLES2Interface gles2;
+
+ skia::RefPtr<GrGLInterface> gl_interface = skia::AdoptRef(new GrGLInterface);
+ skia_bindings::InitGLES2InterfaceBindings(gl_interface.get(), &gles2);
auto gr_context = skia::AdoptRef(GrContext::Create(
kOpenGL_GrBackend,
- reinterpret_cast<GrBackendContext>(null_interface.get())));
+ reinterpret_cast<GrBackendContext>(gl_interface.get())));
gr_context->abandonContext();
- SkCanvas canvas(AllocBitmap(kWidth, kHeight));
-
- TestGLES2Interface gles2;
Context3D context_3d(&gles2, gr_context.get());
gfx::Size size(kWidth, kHeight);
gpu::MailboxHolder mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(),
« no previous file with comments | « media/media.gyp ('k') | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698