Revert "Revert "Make mock GrContext unit testable.""
This reverts commit c867a89b012c07e7e5cb719a31ed90e61f4a4901.
Reason for revert: test
Original change's description:
> Revert "Make mock GrContext unit testable."
>
> This reverts commit 993e7e25217df05d63c3354c817e8bd18ea3738b.
>
> Reason for revert: Seeing if this fixes the NexusPlayer bots
>
> Original change's description:
> > 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>
>
> TBR=egdaniel@google.com,bsalomon@google.com
>
> Change-Id: I25ed9329962d930fe38108f779ff7083e0e4847e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/21731
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I62c579e087db1ff9891cf6c41b3eb40f47561887
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/21733
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/tools/gpu/mock/MockTestContext.cpp b/tools/gpu/mock/MockTestContext.cpp
new file mode 100644
index 0000000..c47fff5
--- /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