blob: 6075bc83c27a2bfe30382ea1dd170ed3838258e7 [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; }
Brian Salomon032aaae2018-03-23 16:10:36 -040023
Brian Salomoncfe910d2017-07-06 16:40:18 -040024 void testAbandon() override {}
25 void submit() override {}
26 void finish() override {}
27
Greg Daniel02611d92017-07-25 10:05:01 -040028 sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
29 return GrContext::MakeMock(nullptr, options);
30 }
31
Brian Salomoncfe910d2017-07-06 16:40:18 -040032protected:
33 void teardown() override {}
34 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 void onPlatformSwapBuffers() const override {}
37
38private:
39 typedef sk_gpu_test::TestContext INHERITED;
40};
41
42} // anonymous namespace
43
44namespace sk_gpu_test {
45
46TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); }
47
48} // namespace sk_gpu_test
49#endif