xref: /aosp_15_r20/external/cronet/base/process/current_process_test.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_PROCESS_CURRENT_PROCESS_TEST_H_
6 #define BASE_PROCESS_CURRENT_PROCESS_TEST_H_
7 
8 #include <string>
9 #include "base/process/current_process.h"
10 
11 namespace base::test {
12 
13 // This class is used for getting current process type and name for testing
14 // without any access controls.
15 class CurrentProcessForTest {
16  public:
GetType()17   static CurrentProcessType GetType() {
18     return CurrentProcess::GetInstance().GetType(CurrentProcess::TypeKey());
19   }
20 
GetName()21   static std::string GetName() {
22     return CurrentProcess::GetInstance().GetName(CurrentProcess::NameKey());
23   }
24 };
25 
26 }  // namespace base::test
27 
28 #endif  // BASE_PROCESS_CURRENT_PROCESS_TEST_H_
29