Debian Codegraph @

tools/ganesh/mock/MockTestContext.cpp

raw
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
9 #include "tools/ganesh/mock/MockTestContext.h"
10
11 #include "include/gpu/ganesh/GrDirectContext.h"
12
13 namespace {
14
15 class MockTestContext : public sk_gpu_test::TestContext {
16 public:
17 MockTestContext() {}
18 ~MockTestContext() override {}
19
20 GrBackendApi backend() override { return GrBackendApi::kMock; }
21
22 void testAbandon() override {}
23
24 sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
25 return GrDirectContext::MakeMock(nullptr, options);
26 }
27
28 protected:
29 void teardown() override {}
30 void onPlatformMakeNotCurrent() const override {}
31 void onPlatformMakeCurrent() const override {}
32 std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; }
33
34 private:
35 using INHERITED = sk_gpu_test::TestContext;
36 };
37
38 } // anonymous namespace
39
40 namespace sk_gpu_test {
41
42 TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); }
43
44 } // namespace sk_gpu_test