blob: a9e29e5602a2daf4a038dc250ca7f8e419c83d54 [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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "tools/gpu/mock/MockTestContext.h"
Brian Salomoncfe910d2017-07-06 16:40:18 -040012
Robert Phillipsf4f80112020-07-13 16:13:31 -040013#include "include/gpu/GrDirectContext.h"
Greg Daniel02611d92017-07-25 10:05:01 -040014
Brian Salomoncfe910d2017-07-06 16:40:18 -040015namespace {
16
17class MockTestContext : public sk_gpu_test::TestContext {
18public:
19 MockTestContext() {}
20 ~MockTestContext() override {}
21
John Stiles1cf2c8d2020-08-13 22:58:04 -040022 GrBackendApi backend() override { return GrBackendApi::kMock; }
Brian Salomon032aaae2018-03-23 16:10:36 -040023
Brian Salomoncfe910d2017-07-06 16:40:18 -040024 void testAbandon() override {}
Brian Salomoncfe910d2017-07-06 16:40:18 -040025 void finish() override {}
26
Robert Phillipsf4f80112020-07-13 16:13:31 -040027 sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override {
28 return GrDirectContext::MakeMock(nullptr, options);
Greg Daniel02611d92017-07-25 10:05:01 -040029 }
30
Brian Salomoncfe910d2017-07-06 16:40:18 -040031protected:
32 void teardown() override {}
Robert Phillipsedf3f382020-02-13 12:59:19 -050033 void onPlatformMakeNotCurrent() const override {}
Brian Salomoncfe910d2017-07-06 16:40:18 -040034 void onPlatformMakeCurrent() const override {}
Brian Salomon55ad7742017-11-17 09:25:23 -050035 std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; }
Brian Salomoncfe910d2017-07-06 16:40:18 -040036
37private:
John Stiles7571f9e2020-09-02 22:42:33 -040038 using INHERITED = sk_gpu_test::TestContext;
Brian Salomoncfe910d2017-07-06 16:40:18 -040039};
40
41} // anonymous namespace
42
43namespace sk_gpu_test {
44
45TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); }
46
47} // namespace sk_gpu_test
48#endif