Commit ae5eec1f authored by Brian Osman's avatar Brian Osman Committed by Commit Bot

Use Mock GrContext (rather than Null GL interface) for all cc unit tests

These tests don't (appear to) need GL specifically, just Skia
resources or a GrContext. Skia's NullGL context is deprecated,
and we'd really like to remove it.

Change-Id: Ie88a4c2ec63617285a724ed8587e6b02d8311f9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540276Reviewed-by: default avatarBrian Salomon <bsalomon@google.com>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Cr-Commit-Position: refs/heads/master@{#644840}
parent f3f337c0
......@@ -8,7 +8,6 @@
#include "cc/test/test_skcanvas.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
using ::testing::_;
using ::testing::StrictMock;
......@@ -21,8 +20,7 @@ namespace cc {
// only case where the context is accessed.
TEST(SkiaPaintCanvasTest, ContextFlushesDirect) {
sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface());
auto context = GrContext::MakeGL(std::move(gl_interface));
auto context = GrContext::MakeMock(nullptr);
StrictMock<MockCanvas> mock_canvas;
EXPECT_CALL(mock_canvas, getGrContext())
.Times(2)
......@@ -40,8 +38,7 @@ TEST(SkiaPaintCanvasTest, ContextFlushesDirect) {
}
TEST(SkiaPaintCanvasTest, ContextFlushesRecording) {
sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface());
auto context = GrContext::MakeGL(std::move(gl_interface));
auto context = GrContext::MakeMock(nullptr);
StrictMock<MockCanvas> mock_canvas;
EXPECT_CALL(mock_canvas, getGrContext())
.Times(2)
......
......@@ -17,7 +17,6 @@
#include "third_party/skia/include/core/SkImageGenerator.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/skia_util.h"
......@@ -227,8 +226,7 @@ scoped_refptr<SkottieWrapper> CreateSkottie(const gfx::Size& size,
}
PaintImage CreateNonDiscardablePaintImage(const gfx::Size& size) {
sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface());
auto context = GrContext::MakeGL(std::move(gl_interface));
auto context = GrContext::MakeMock(nullptr);
SkBitmap bitmap;
auto info = SkImageInfo::Make(size.width(), size.height(), kN32_SkColorType,
kPremul_SkAlphaType, nullptr /* color_space */);
......
......@@ -6,15 +6,13 @@
#include "base/containers/span.h"
#include "base/logging.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
namespace cc {
TransferCacheTestHelper::TransferCacheTestHelper(GrContext* context)
: context_(context) {
if (!context_) {
sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface());
owned_context_ = GrContext::MakeGL(std::move(gl_interface));
owned_context_ = GrContext::MakeMock(nullptr);
context_ = owned_context_.get();
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment