xref: /aosp_15_r20/external/deqp/external/openglcts/modules/runner/glcAndroidTestActivity.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _GLCANDROIDTESTACTIVITY_HPP
2 #define _GLCANDROIDTESTACTIVITY_HPP
3 /*-------------------------------------------------------------------------
4  * OpenGL Conformance Test Suite
5  * -----------------------------
6  *
7  * Copyright (c) 2016 Google Inc.
8  * Copyright (c) 2016 The Khronos Group Inc.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */ /*!
23  * \file
24  * \brief CTS Android Activity.
25  */ /*-------------------------------------------------------------------*/
26 
27 #include "glcTestRunner.hpp"
28 #include "gluRenderContext.hpp"
29 #include "tcuAndroidAssets.hpp"
30 #include "tcuAndroidPlatform.hpp"
31 #include "tcuAndroidRenderActivity.hpp"
32 #include "tcuCommandLine.hpp"
33 #include "tcuDefs.hpp"
34 #include "tcuTestLog.hpp"
35 
36 namespace glcts
37 {
38 namespace Android
39 {
40 
41 class TestThread : public tcu::Android::RenderThread
42 {
43 public:
44     TestThread(tcu::Android::NativeActivity &nativeActivity, tcu::Android::AssetArchive &archive,
45                const std::string &waiverPath, const std::string &logPath, glu::ApiType runType, uint32_t runFlags);
46     ~TestThread(void);
47 
48     void run(void);
49 
50 protected:
51     virtual void onWindowCreated(ANativeWindow *window);
52     virtual void onWindowResized(ANativeWindow *window);
53     virtual void onWindowDestroyed(ANativeWindow *window);
54     virtual bool render(void);
55 
56     tcu::Android::Platform m_platform;
57     tcu::Android::AssetArchive &m_archive;
58     TestRunner m_app;
59     bool m_finished; //!< Is execution finished.
60 };
61 
62 class TestActivity : public tcu::Android::RenderActivity
63 {
64 public:
65     TestActivity(ANativeActivity *nativeActivity, glu::ApiType runType);
66     ~TestActivity(void);
67 
68     virtual void onStart(void);
69     virtual void onDestroy(void);
70     virtual void onConfigurationChanged(void);
71 
72 private:
73     tcu::Android::AssetArchive m_archive;
74     tcu::CommandLine m_cmdLine;
75     TestThread m_testThread;
76     bool m_started;
77 };
78 
79 class GetTestParamThread : public tcu::Android::RenderThread
80 {
81 public:
82     GetTestParamThread(tcu::Android::NativeActivity &nativeActivity, const std::string &logPath, glu::ApiType runType);
83     ~GetTestParamThread(void);
84 
85     void run(void);
86 
87 protected:
88     virtual void onWindowCreated(ANativeWindow *window);
89     virtual void onWindowResized(ANativeWindow *window);
90     virtual void onWindowDestroyed(ANativeWindow *window);
91     virtual bool render(void);
92 
93     tcu::Android::Platform m_platform;
94     TestParamCollectorRunner m_app;
95     bool m_finished; //!< Is execution finished.
96 };
97 
98 class GetTestParamActivity : public tcu::Android::RenderActivity
99 {
100 public:
101     GetTestParamActivity(ANativeActivity *nativeActivity, glu::ApiType runType);
102     ~GetTestParamActivity(void);
103 
104     virtual void onStart(void);
105     virtual void onDestroy(void);
106     virtual void onConfigurationChanged(void);
107 
108 private:
109     GetTestParamThread m_testThread;
110     bool m_started;
111 };
112 
113 } // namespace Android
114 } // namespace glcts
115 
116 #endif // _GLCANDROIDTESTACTIVITY_HPP
117