Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "tools/gpu/mock/MockTestContext.h" |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 12 | |
Robert Phillips | f4f8011 | 2020-07-13 16:13:31 -0400 | [diff] [blame] | 13 | #include "include/gpu/GrDirectContext.h" |
Greg Daniel | 02611d9 | 2017-07-25 10:05:01 -0400 | [diff] [blame] | 14 | |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 15 | namespace { |
| 16 | |
| 17 | class MockTestContext : public sk_gpu_test::TestContext { |
| 18 | public: |
| 19 | MockTestContext() {} |
| 20 | ~MockTestContext() override {} |
| 21 | |
John Stiles | 1cf2c8d | 2020-08-13 22:58:04 -0400 | [diff] [blame] | 22 | GrBackendApi backend() override { return GrBackendApi::kMock; } |
Brian Salomon | 032aaae | 2018-03-23 16:10:36 -0400 | [diff] [blame] | 23 | |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 24 | void testAbandon() override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 25 | void finish() override {} |
| 26 | |
Robert Phillips | f4f8011 | 2020-07-13 16:13:31 -0400 | [diff] [blame] | 27 | sk_sp<GrDirectContext> makeContext(const GrContextOptions& options) override { |
| 28 | return GrDirectContext::MakeMock(nullptr, options); |
Greg Daniel | 02611d9 | 2017-07-25 10:05:01 -0400 | [diff] [blame] | 29 | } |
| 30 | |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 31 | protected: |
| 32 | void teardown() override {} |
Robert Phillips | edf3f38 | 2020-02-13 12:59:19 -0500 | [diff] [blame] | 33 | void onPlatformMakeNotCurrent() const override {} |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 34 | void onPlatformMakeCurrent() const override {} |
Brian Salomon | 55ad774 | 2017-11-17 09:25:23 -0500 | [diff] [blame] | 35 | std::function<void()> onPlatformGetAutoContextRestore() const override { return nullptr; } |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 36 | |
| 37 | private: |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 38 | using INHERITED = sk_gpu_test::TestContext; |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | } // anonymous namespace |
| 42 | |
| 43 | namespace sk_gpu_test { |
| 44 | |
| 45 | TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); } |
| 46 | |
| 47 | } // namespace sk_gpu_test |
| 48 | #endif |