utils.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef TEST_CTS_UTILS_H_
  17. #define TEST_CTS_UTILS_H_
  18. #include <string>
  19. #include "src/base/test/test_task_runner.h"
  20. namespace perfetto {
  21. bool IsDebuggableBuild();
  22. bool IsUserBuild();
  23. bool IsAppRunning(const std::string& name);
  24. // returns -1 if the process wasn't found
  25. int PidForProcessName(const std::string& name);
  26. void WaitForProcess(const std::string& process,
  27. const std::string& checkpoint_name,
  28. base::TestTaskRunner* task_runner,
  29. uint32_t delay_ms = 1);
  30. void StartAppActivity(const std::string& app_name,
  31. const std::string& activity_name,
  32. const std::string& checkpoint_name,
  33. base::TestTaskRunner* task_runner,
  34. uint32_t delay_ms = 1);
  35. void StopApp(const std::string& app_name,
  36. const std::string& checkpoint_name,
  37. base::TestTaskRunner* task_runner);
  38. void StopApp(const std::string& app_name);
  39. } // namespace perfetto
  40. #endif // TEST_CTS_UTILS_H_