Files
brave-core/patches/chrome-test-base-testing_browser_process.cc.patch
T
cdesouza-chromium 4797f82d2d [CodeHealth] Simplify override for TestingBrowserProcess (#30559)
[codehealth][CodeHealth] Simplify override for `TestingBrowserProcess`

The original override class, which uses inheritance has had to go
through a few fixes, as it riddled with Undefined Behaviour, however
once it became apparent patching was needed, the whole point of using
inheritance for this override is lost, as the current override is
bloated, and it is not avoiding patching in any way.

This PR simplifies the override for this type by having macro hooks
patched into the class, to allow us to manage the lifetime of
`TestingBraveBrowserProcess` through `TestingBraveBrowserProcess`.

Resolves https://github.com/brave/brave-browser/issues/48183
2025-08-11 18:40:32 +01:00

27 lines
1.0 KiB
Diff

diff --git a/chrome/test/base/testing_browser_process.cc b/chrome/test/base/testing_browser_process.cc
index 693321f66c798fc35a8f3246d1257d03377d1798..bf11c03e6323dc844f68b44cf3bd693d109d879a 100644
--- a/chrome/test/base/testing_browser_process.cc
+++ b/chrome/test/base/testing_browser_process.cc
@@ -130,6 +130,7 @@ void TestingBrowserProcess::CreateInstance() {
std::move(fake_geolocation_system_permission_manager));
}
#endif // BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
+ BRAVE_TESTING_BROWSER_PROCESS_CREATE_INSTANCE
}
// static
@@ -138,11 +139,13 @@ void TestingBrowserProcess::DeleteInstance() {
BrowserProcess* browser_process = g_browser_process;
g_browser_process = nullptr;
delete browser_process;
+ BRAVE_TESTING_BROWSER_PROCESS_DELETE_INSTANCE
}
// static
void TestingBrowserProcess::TearDownAndDeleteInstance() {
TestingBrowserProcess::DeleteInstance();
+ BRAVE_TESTING_BROWSER_PROCESS_TEAR_DOWN_AND_DELETE_INSTANCE
}
TestingBrowserProcess::TestingBrowserProcess()