1 #ifndef _TCUANDROIDEXECSERVICE_HPP
2 #define _TCUANDROIDEXECSERVICE_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Android ExecService.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "deThread.hpp"
28 #include "xsExecutionServer.hpp"
29 #include "xsPosixFileReader.hpp"
41 DEFAULT_SOCKETFAMILY = DE_SOCKETFAMILY_INET4
44 class TestProcess : public xs::TestProcess
47 TestProcess (JavaVM* vm, jobject context);
50 virtual void start (const char* name, const char* params, const char* workingDir, const char* caseList);
51 virtual void terminate (void);
52 virtual void cleanup (void);
54 virtual bool isRunning (void);
55 virtual int getExitCode (void) const;
57 virtual int readTestLog (deUint8* dst, int numBytes);
58 virtual int readInfoLog (deUint8* dst, int numBytes);
61 JNIEnv* getCurrentThreadEnv (void);
68 jmethodID m_isRunning;
70 deUint64 m_launchTime;
71 deUint64 m_lastQueryTime;
72 bool m_lastRunningStatus;
73 xs::posix::FileReader m_logReader;
76 class ExecutionServer : public xs::ExecutionServer
79 ExecutionServer (JavaVM* vm, xs::TestProcess* testProcess, deSocketFamily family, int port, RunMode runMode);
80 xs::ConnectionHandler* createHandler (de::Socket* socket, const de::SocketAddress& clientAddress);
86 class ConnectionHandler : public xs::ExecutionRequestHandler
89 ConnectionHandler (JavaVM* vm, xs::ExecutionServer* server, de::Socket* socket);
96 class ServerThread : public de::Thread
99 ServerThread (JavaVM* vm, xs::TestProcess* testProcess, deSocketFamily family, int port);
105 ExecutionServer m_server;
111 ExecService (JavaVM* vm, jobject context, int port, deSocketFamily family = (deSocketFamily)DEFAULT_SOCKETFAMILY);
118 ExecService (const ExecService& other);
119 ExecService& operator= (const ExecService& other);
121 TestProcess m_process;
122 ServerThread m_thread;
128 #endif // _TCUANDROIDEXECSERVICE_HPP