• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/GrContext.h"
14 
15 namespace {
16 
17 class MockTestContext : public sk_gpu_test::TestContext {
18 public:
MockTestContext()19     MockTestContext() {}
~MockTestContext()20     ~MockTestContext() override {}
21 
backend()22     virtual GrBackendApi backend() override { return GrBackendApi::kMock; }
23 
testAbandon()24     void testAbandon() override {}
submit()25     void submit() override {}
finish()26     void finish() override {}
27 
makeGrContext(const GrContextOptions & options)28     sk_sp<GrContext> makeGrContext(const GrContextOptions& options) override {
29         return GrContext::MakeMock(nullptr, options);
30     }
31 
32 protected:
teardown()33     void teardown() override {}
onPlatformMakeCurrent() const34     void onPlatformMakeCurrent() const override {}
onPlatformGetAutoContextRestore() const35     std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; }
onPlatformSwapBuffers() const36     void onPlatformSwapBuffers() const override {}
37 
38 private:
39     typedef sk_gpu_test::TestContext INHERITED;
40 };
41 
42 } // anonymous namespace
43 
44 namespace sk_gpu_test {
45 
CreateMockTestContext(TestContext *)46 TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); }
47 
48 }  // namespace sk_gpu_test
49 #endif
50