blob: 30ee94718f04cd2ab16eb8879a1b1ae7f47d7494 [file] [log] [blame]
Florian Mayere8599d42019-10-14 14:58:15 +01001/*
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 Tuccid6dc0c02020-12-01 16:15:28 +010017#ifndef TEST_ANDROID_TEST_UTILS_H_
18#define TEST_ANDROID_TEST_UTILS_H_
Florian Mayere8599d42019-10-14 14:58:15 +010019
20#include <string>
21
22#include "src/base/test/test_task_runner.h"
23
24namespace perfetto {
25
26bool IsDebuggableBuild();
Florian Mayer79c86842020-03-31 11:52:55 +020027bool IsUserBuild();
Florian Mayere8599d42019-10-14 14:58:15 +010028
29bool IsAppRunning(const std::string& name);
30
Ryan Savitski9fa72002020-02-19 14:31:20 +000031// returns -1 if the process wasn't found
32int PidForProcessName(const std::string& name);
33
Hector Dearmanec1de7d2020-02-07 16:17:40 +000034void WaitForProcess(const std::string& process,
35 const std::string& checkpoint_name,
36 base::TestTaskRunner* task_runner,
37 uint32_t delay_ms = 1);
38
Florian Mayere8599d42019-10-14 14:58:15 +010039void StartAppActivity(const std::string& app_name,
Hector Dearmanec1de7d2020-02-07 16:17:40 +000040 const std::string& activity_name,
Florian Mayere8599d42019-10-14 14:58:15 +010041 const std::string& checkpoint_name,
42 base::TestTaskRunner* task_runner,
Hector Dearmanec1de7d2020-02-07 16:17:40 +000043 uint32_t delay_ms = 1);
Florian Mayere8599d42019-10-14 14:58:15 +010044
45void StopApp(const std::string& app_name,
46 const std::string& checkpoint_name,
47 base::TestTaskRunner* task_runner);
48
Florian Mayerbdc48df2020-02-20 17:25:03 +000049void StopApp(const std::string& app_name);
Florian Mayere8599d42019-10-14 14:58:15 +010050
51} // namespace perfetto
52
Primiano Tuccid6dc0c02020-12-01 16:15:28 +010053#endif // TEST_ANDROID_TEST_UTILS_H_