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 GRAPHIC_LITE_TEST_MESSAGE_H
17 #define GRAPHIC_LITE_TEST_MESSAGE_H
18 
19 #include <algorithm>
20 #include <functional>
21 #include <list>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 namespace OHOS {
27 enum TestEventID : uint8_t {
28     TEST_CLICK_EVENT,
29     TEST_MOVE_EVENT,
30 };
31 
32 enum TestMode: uint8_t {
33     TEST_MODE_BASE = 1,
34     TEST_MODE_RUN,
35 };
36 
37 struct TestSteps {
38     std::string viewID;
39     TestEventID eventID;
40     std::vector<int> eventValue;
41     bool saveCheckPoint;
42 };
43 
44 struct TestMsgInfo {
45     std::string className;
46     std::vector<std::string> pageNav;
47     std::vector<TestSteps> steps;
48 };
49 
50 struct TestConfigInfo {
TestConfigInfoTestConfigInfo51     TestConfigInfo()
52     {
53         testMode = TEST_MODE_BASE;
54     }
55     TestMode testMode;
56     std::string baseDir;
57     std::string runDir;
58     std::string logDir;
59 };
60 
61 const std::string JSON_VALUE_MAIN_ID = "main_id";
62 const std::string JOSN_VALUE_TEST_MODE = "test_mode";
63 const std::string JSON_VALUE_BASE_DIR = "base_dir";
64 const std::string JSON_VALUE_RUN_DIR = "run_dir";
65 const std::string JSON_VALUE_LOG_DIR = "log_dir";
66 
67 const std::string JSON_VALUE_TEST_INFO = "testInfo";
68 const std::string JSON_VALUE_CLASS_NAME = "className";
69 const std::string JSON_VALUE_PAGE_NAV = "pageNav";
70 const std::string JSON_VALUE_TEST_STEPS = "testSteps";
71 const std::string JSON_VALUE_VIEW_ID = "viewID";
72 const std::string JSON_VALUE_EVENT_ID = "eventID";
73 const std::string JSON_VALUE_EVENT_VALUE = "eventValue";
74 const std::string JSON_VALUE_SAVE_CHECK_POINT = "saveCheckPoint";
75 
76 const size_t EVENT_VALUE_SIZE_TWO = 2;
77 
78 const size_t S_C_MAIN_ID_SEND_CONFIG_INFO = 1;              // Send config information
79 const size_t C_S_MAIN_ID_REQUEST_TEST_INFO = 2;             // Request to start test
80 const size_t S_C_MAIN_ID_SEND_TEST_INFO = 3;                // Distribute test data
81 const size_t C_S_MAIN_ID_TEST_FINISH_INFO = 4;              // Test a set of data
82 const size_t S_C_MAIN_ID_All_TESTS_COMPLETE = 5;            // All tests completed
83 } // namespace OHOS
84 
85 #endif // GRAPHIC_LITE_TEST_MESSAGE_H
86