1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #ifndef FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_ |
6 | #define FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_ |
7 | |
8 | #include "flutter/flow/gl_context_switch.h" |
9 | #include "gtest/gtest.h" |
10 | |
11 | namespace flutter { |
12 | namespace testing { |
13 | |
14 | class GLContextSwitchTest : public ::testing::Test { |
15 | public: |
16 | GLContextSwitchTest(); |
17 | }; |
18 | |
19 | //------------------------------------------------------------------------------ |
20 | /// The renderer context used for testing |
21 | class TestSwitchableGLContext : public SwitchableGLContext { |
22 | public: |
23 | TestSwitchableGLContext(int context); |
24 | |
25 | ~TestSwitchableGLContext() override; |
26 | |
27 | bool SetCurrent() override; |
28 | |
29 | bool RemoveCurrent() override; |
30 | |
31 | int GetContext(); |
32 | |
33 | static int GetCurrentContext(); |
34 | |
35 | //------------------------------------------------------------------------------ |
36 | /// Set the current context |
37 | /// |
38 | /// This is to mimic how other programs outside flutter sets the context. |
39 | static void SetCurrentContext(int context); |
40 | |
41 | private: |
42 | int context_; |
43 | |
44 | FML_DISALLOW_COPY_AND_ASSIGN(TestSwitchableGLContext); |
45 | }; |
46 | |
47 | } // namespace testing |
48 | } // namespace flutter |
49 | |
50 | #endif // FLUTTER_SHELL_RENDERER_CONTEXT_TEST_H_ |
51 | |