1 2 /* 3 * Copyright 2017 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 #ifndef GLTestContext_DEFINED 9 #define GLTestContext_DEFINED 10 11 #include "tools/gpu/mock/MockTestContext.h" 12 13 #include "include/gpu/ganesh/GrDirectContext.h" 14 15 namespace { 16 17 class MockTestContext : public sk_gpu_test::TestContext { 18 public: MockTestContext()19 MockTestContext() {} ~MockTestContext()20 ~MockTestContext() override {} 21 backend()22 GrBackendApi backend() override { return GrBackendApi::kMock; } 23 testAbandon()24 void testAbandon() override {} 25 makeContext(const GrContextOptions & options)26 sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override { 27 return GrDirectContext::MakeMock(nullptr, options); 28 } 29 30 protected: teardown()31 void teardown() override {} onPlatformMakeNotCurrent() const32 void onPlatformMakeNotCurrent() const override {} onPlatformMakeCurrent() const33 void onPlatformMakeCurrent() const override {} onPlatformGetAutoContextRestore() const34 std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; } 35 36 private: 37 using INHERITED = sk_gpu_test::TestContext; 38 }; 39 40 } // anonymous namespace 41 42 namespace sk_gpu_test { 43 CreateMockTestContext(TestContext *)44TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); } 45 46 } // namespace sk_gpu_test 47 #endif 48