blob: 5cc5529dfe6d7710e8cc96921314302023b81a71 [file] [log] [blame]
Brian Salomoncfe910d2017-07-06 16:40:18 -04001
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 "MockTestContext.h"
12
Greg Daniel02611d92017-07-25 10:05:01 -040013#include "GrContext.h"
14
Brian Salomoncfe910d2017-07-06 16:40:18 -040015namespace {
16
17class MockTestContext : public sk_gpu_test::TestContext {
18public:
19 MockTestContext() {}
20 ~MockTestContext() override {}
21
22 virtual GrBackend backend() override { return kMock_GrBackend; }
23 virtual GrBackendContext backendContext() override {
24 return reinterpret_cast<GrBackendContext>(nullptr);
25 }
Brian Salomoncfe910d2017-07-06 16:40:18 -040026 void testAbandon() override {}
27 void submit() override {}
28 void finish() override {}
29
Greg Daniel02611d92017-07-25 10:05:01 -040030 sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
31 return GrContext::MakeMock(nullptr, options);
32 }
33
Brian Salomoncfe910d2017-07-06 16:40:18 -040034protected:
35 void teardown() override {}
36 void onPlatformMakeCurrent() const override {}
Brian Salomon55ad7742017-11-17 09:25:23 -050037 std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; }
Brian Salomoncfe910d2017-07-06 16:40:18 -040038 void onPlatformSwapBuffers() const override {}
39
40private:
41 typedef sk_gpu_test::TestContext INHERITED;
42};
43
44} // anonymous namespace
45
46namespace sk_gpu_test {
47
48TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); }
49
50} // namespace sk_gpu_test
51#endif