diff options
author | 2017-07-06 10:51:32 -0400 | |
---|---|---|
committer | 2017-07-06 15:25:35 +0000 | |
commit | 993e7e25217df05d63c3354c817e8bd18ea3738b (patch) | |
tree | cd1e0979409546c96d5ebfa55e1f62f77c4dc352 /tools/gpu/mock/MockTestContext.cpp | |
parent | 0c26a9dbd0b6546731df63c01411cb2aaa5ba236 (diff) |
Make mock GrContext unit testable.
Bug: skia:
Change-Id: I959122f1f2c390832ab1033bcdbdd2ca6cfc0419
Reviewed-on: https://skia-review.googlesource.com/20699
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tools/gpu/mock/MockTestContext.cpp')
-rw-r--r-- | tools/gpu/mock/MockTestContext.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/gpu/mock/MockTestContext.cpp b/tools/gpu/mock/MockTestContext.cpp new file mode 100644 index 0000000000..c47fff5de3 --- /dev/null +++ b/tools/gpu/mock/MockTestContext.cpp @@ -0,0 +1,45 @@ + +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef GLTestContext_DEFINED +#define GLTestContext_DEFINED + +#include "MockTestContext.h" + +namespace { + +class MockTestContext : public sk_gpu_test::TestContext { +public: + MockTestContext() {} + ~MockTestContext() override {} + + virtual GrBackend backend() override { return kMock_GrBackend; } + virtual GrBackendContext backendContext() override { + return reinterpret_cast<GrBackendContext>(nullptr); + } + bool isValid() const override { return true; } + void testAbandon() override {} + void submit() override {} + void finish() override {} + +protected: + void teardown() override {} + void onPlatformMakeCurrent() const override {} + void onPlatformSwapBuffers() const override {} + +private: + typedef sk_gpu_test::TestContext INHERITED; +}; + +} // anonymous namespace + +namespace sk_gpu_test { + +TestContext* CreateMockTestContext(TestContext*) { return new MockTestContext(); } + +} // namespace sk_gpu_test +#endif |