1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef __VTS_SYSFUZZER_COMMON_REPLAYER_VTSHIDLHALREPLAYER_H__
17 #define __VTS_SYSFUZZER_COMMON_REPLAYER_VTSHIDLHALREPLAYER_H__
18 
19 #include "driver_manager/VtsHalDriverManager.h"
20 #include "test/vts/proto/VtsProfilingMessage.pb.h"
21 
22 namespace android {
23 namespace vts {
24 
25 // Class to perform VTS record and replay test.
26 // The class is responsible for:
27 // 1) Load and parse a given trace file.
28 // 2) Replay the API call sequence parsed from the trace file by calling
29 //    the HAL drive.
30 // 3) Verify the return results of each API calls.
31 class VtsHidlHalReplayer {
32  public:
VtsHidlHalReplayer(VtsHalDriverManager * driver_manager)33   explicit VtsHidlHalReplayer(VtsHalDriverManager* driver_manager)
34       : driver_manager_(driver_manager) {}
35 
36   // Replays the API call sequence parsed from the trace file.
37   bool ReplayTrace(const std::string& trace_file,
38                    map<string, string>& hal_service_instances);
39 
40   // Print the HAL service recorded in the trace file.
41   void ListTestServices(const string& trace_file);
42 
43  private:
44   // Used to load the vts spec and driver library. Does not own.
45   VtsHalDriverManager* driver_manager_;
46 };
47 
48 }  // namespace vts
49 }  // namespace android
50 
51 #endif  // __VTS_SYSFUZZER_COMMON_REPLAYER_VTSHIDLHALREPLAYER_H__
52