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
15namespace {
16
17class MockTestContext : public sk_gpu_test::TestContext {
18public:
19    MockTestContext() {}
20    ~MockTestContext() override {}
21
22    GrBackendApi backend() override { return GrBackendApi::kMock; }
23
24    void testAbandon() override {}
25    void finish() override {}
26
27    sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
28        return GrDirectContext::MakeMock(nullptr, options);
29    }
30
31protected:
32    void teardown() override {}
33    void onPlatformMakeNotCurrent() const override {}
34    void onPlatformMakeCurrent() const override {}
35    std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; }
36
37private:
38    using INHERITED = sk_gpu_test::TestContext;
39};
40
41} // anonymous namespace
42
43namespace sk_gpu_test {
44
45TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); }
46
47}  // namespace sk_gpu_test
48#endif
49