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 17 #ifndef TEST_ANDROID_TEST_UTILS_H_ 18 #define TEST_ANDROID_TEST_UTILS_H_ 19 20 #include <string> 21 22 #include "src/base/test/test_task_runner.h" 23 24 namespace perfetto { 25 26 bool IsDebuggableBuild(); 27 bool IsUserBuild(); 28 29 bool IsAppRunning(const std::string& name); 30 31 // returns -1 if the process wasn't found 32 int PidForProcessName(const std::string& name); 33 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 39 void StartAppActivity(const std::string& app_name, 40 const std::string& activity_name, 41 const std::string& checkpoint_name, 42 base::TestTaskRunner* task_runner, 43 uint32_t delay_ms = 1); 44 45 void StopApp(const std::string& app_name, 46 const std::string& checkpoint_name, 47 base::TestTaskRunner* task_runner); 48 49 void StopApp(const std::string& app_name); 50 51 } // namespace perfetto 52 53 #endif // TEST_ANDROID_TEST_UTILS_H_ 54