1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ABILITY_RUNTIME_ITEST_OBSERVER_H
17 #define OHOS_ABILITY_RUNTIME_ITEST_OBSERVER_H
18 
19 #include "iremote_broker.h"
20 #include "shell_command_result.h"
21 
22 namespace OHOS {
23 namespace AAFwk {
24 class ITestObserver : public IRemoteBroker {
25 public:
26     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.ITestObserver");
27 
28     /**
29      * Outputs test status.
30      *
31      * @param msg, Indicates the status information.
32      * @param resultCode, Indicates the result code.
33      */
34     virtual void TestStatus(const std::string& msg, const int64_t& resultCode) = 0;
35 
36     /**
37      * Outputs information and result code that the test has finished.
38      *
39      * @param msg, Indicates the status information.
40      * @param resultCode, Indicates the result code.
41      */
42     virtual void TestFinished(const std::string& msg, const int64_t& resultCode) = 0;
43 
44     /**
45      * Executes the specified shell command.
46      *
47      * @param cmd, Indicates the specified shell command.
48      * @param timeoutSec, Indicates the specified time out time, in seconds.
49      * @return the result of the specified shell command.
50      */
51     virtual ShellCommandResult ExecuteShellCommand(const std::string& cmd, const int64_t timeoutSec) = 0;
52 
53     enum class Message {
54         // ipc id for test status (1)
55         AA_TEST_STATUS = 1,
56         // ipc id for test finished (2)
57         AA_TEST_FINISHED = 2,
58         // ipc id for execute shell command (3)
59         AA_EXECUTE_SHELL_COMMAND = 3,
60     };
61 };
62 }  // namespace AAFwk
63 }  // namespace OHOS
64 
65 #endif  // OHOS_ABILITY_RUNTIME_ITEST_OBSERVER_H
66