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 
17 #ifndef ADB_H
18 #define ADB_H
19 
20 #include "proto/instrumentation_data.pb.h"
21 
22 #include <string>
23 
24 using namespace android::am;
25 using namespace google::protobuf;
26 using namespace std;
27 
28 class InstrumentationCallbacks {
29 public:
30     virtual void OnTestStatus(TestStatus& status) = 0;
31     virtual void OnSessionStatus(SessionStatus& status) = 0;
32 };
33 
34 int run_adb(const char* first, ...);
35 
36 string get_system_property(const string& name, int* err);
37 
38 int run_instrumentation_test(const string& packageName, const string& runner,
39         const string& className, InstrumentationCallbacks* callbacks);
40 
41 string get_bundle_string(const ResultsBundle& bundle, bool* found, ...);
42 int32_t get_bundle_int(const ResultsBundle& bundle, bool* found, ...);
43 float get_bundle_float(const ResultsBundle& bundle, bool* found, ...);
44 double get_bundle_double(const ResultsBundle& bundle, bool* found, ...);
45 int64_t get_bundle_long(const ResultsBundle& bundle, bool* found, ...);
46 
47 #endif // ADB_H
48