• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SRC_TRACING_TEST_API_TEST_SUPPORT_H_
18 #define SRC_TRACING_TEST_API_TEST_SUPPORT_H_
19 
20 // This header is intended to be used only for api_integrationtest.cc and solves
21 // the following problem: api_integrationtest.cc doesn't pull any non-public
22 // perfetto header, to spot accidental public->non-public dependencies.
23 // Sometimes, however, we need to use some internal perfetto code for the test
24 // itself. This header exposes wrapper functions to achieve that without leaking
25 // internal headers.
26 
27 //  IMPORTANT: This header must not pull any non-public perfetto header.
28 
29 #include <stdint.h>
30 #include "perfetto/tracing.h"
31 
32 namespace perfetto {
33 namespace test {
34 
35 int32_t GetCurrentProcessId();
36 bool StartSystemService();
37 void SyncProducers();
38 
39 void SetBatchCommitsDuration(uint32_t batch_commits_duration_ms,
40                              BackendType backend_type);
41 
42 bool EnableDirectSMBPatching(BackendType backend_type);
43 
44 void DisableReconnectLimit();
45 
46 struct TestTempFile {
47   int fd;
48   std::string path;
49 };
50 
51 // The caller must close(2) the returned TempFile.fd.
52 TestTempFile CreateTempFile();
53 
54 }  // namespace test
55 }  // namespace perfetto
56 
57 #endif  // SRC_TRACING_TEST_API_TEST_SUPPORT_H_
58