Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | |
Primiano Tucci | d6dc0c0 | 2020-12-01 16:15:28 +0100 | [diff] [blame] | 17 | #ifndef TEST_ANDROID_TEST_UTILS_H_ |
| 18 | #define TEST_ANDROID_TEST_UTILS_H_ |
Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 19 | |
| 20 | #include <string> |
| 21 | |
| 22 | #include "src/base/test/test_task_runner.h" |
| 23 | |
| 24 | namespace perfetto { |
| 25 | |
| 26 | bool IsDebuggableBuild(); |
Florian Mayer | 79c8684 | 2020-03-31 11:52:55 +0200 | [diff] [blame] | 27 | bool IsUserBuild(); |
Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 28 | |
| 29 | bool IsAppRunning(const std::string& name); |
| 30 | |
Ryan Savitski | 9fa7200 | 2020-02-19 14:31:20 +0000 | [diff] [blame] | 31 | // returns -1 if the process wasn't found |
| 32 | int PidForProcessName(const std::string& name); |
| 33 | |
Hector Dearman | ec1de7d | 2020-02-07 16:17:40 +0000 | [diff] [blame] | 34 | void WaitForProcess(const std::string& process, |
| 35 | const std::string& checkpoint_name, |
| 36 | base::TestTaskRunner* task_runner, |
| 37 | uint32_t delay_ms = 1); |
| 38 | |
Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 39 | void StartAppActivity(const std::string& app_name, |
Hector Dearman | ec1de7d | 2020-02-07 16:17:40 +0000 | [diff] [blame] | 40 | const std::string& activity_name, |
Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 41 | const std::string& checkpoint_name, |
| 42 | base::TestTaskRunner* task_runner, |
Hector Dearman | ec1de7d | 2020-02-07 16:17:40 +0000 | [diff] [blame] | 43 | uint32_t delay_ms = 1); |
Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 44 | |
| 45 | void StopApp(const std::string& app_name, |
| 46 | const std::string& checkpoint_name, |
| 47 | base::TestTaskRunner* task_runner); |
| 48 | |
Florian Mayer | bdc48df | 2020-02-20 17:25:03 +0000 | [diff] [blame] | 49 | void StopApp(const std::string& app_name); |
Florian Mayer | e8599d4 | 2019-10-14 14:58:15 +0100 | [diff] [blame] | 50 | |
| 51 | } // namespace perfetto |
| 52 | |
Primiano Tucci | d6dc0c0 | 2020-12-01 16:15:28 +0100 | [diff] [blame] | 53 | #endif // TEST_ANDROID_TEST_UTILS_H_ |