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/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 {} finish()25 void finish() override {} 26 makeContext(const GrContextOptions & options)27 sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override { 28 return GrDirectContext::MakeMock(nullptr, options); 29 } 30 31 protected: teardown()32 void teardown() override {} onPlatformMakeNotCurrent() const33 void onPlatformMakeNotCurrent() const override {} onPlatformMakeCurrent() const34 void onPlatformMakeCurrent() const override {} onPlatformGetAutoContextRestore() const35 std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; } 36 37 private: 38 using INHERITED = sk_gpu_test::TestContext; 39 }; 40 41 } // anonymous namespace 42 43 namespace sk_gpu_test { 44 CreateMockTestContext(TestContext *)45TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); } 46 47 } // namespace sk_gpu_test 48 #endif 49