-
Notifications
You must be signed in to change notification settings - Fork 901
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use BraveMainDelegate for brave_browser_tests
So far, ChromeMainDelegate is used.
- Loading branch information
Showing
4 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/test/base/brave_test_launcher_delegate.h" | ||
|
||
#include "brave/app/brave_main_delegate.h" | ||
|
||
BraveTestLauncherDelegate::BraveTestLauncherDelegate( | ||
ChromeTestSuiteRunner* runner) | ||
: ChromeTestLauncherDelegate(runner) {} | ||
|
||
BraveTestLauncherDelegate::~BraveTestLauncherDelegate() = default; | ||
|
||
content::ContentMainDelegate* | ||
BraveTestLauncherDelegate::CreateContentMainDelegate() { | ||
return new BraveMainDelegate(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_TEST_BASE_BRAVE_TEST_LAUNCHER_H_ | ||
#define BRAVE_TEST_BASE_BRAVE_TEST_LAUNCHER_H_ | ||
|
||
#include "chrome/test/base/chrome_test_launcher.h" | ||
#include "base/macros.h" | ||
|
||
class BraveTestLauncherDelegate : public ChromeTestLauncherDelegate { | ||
public: | ||
// Does not take ownership of ChromeTestSuiteRunner. | ||
explicit BraveTestLauncherDelegate(ChromeTestSuiteRunner* runner); | ||
~BraveTestLauncherDelegate() override; | ||
|
||
private: | ||
// ChromeLauncherDelegate: | ||
content::ContentMainDelegate* CreateContentMainDelegate() override; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
DISALLOW_COPY_AND_ASSIGN(BraveTestLauncherDelegate); | ||
}; | ||
|
||
#endif // BRAVE_TEST_BASE_BRAVE_TEST_LAUNCHER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "base/command_line.h" | ||
#include "base/test/launcher/test_launcher.h" | ||
#include "brave/test/base/brave_test_launcher_delegate.h" | ||
#include "build/build_config.h" | ||
|
||
#if defined(OS_WIN) | ||
#include "base/test/test_switches.h" | ||
#include "base/win/win_util.h" | ||
#endif // defined(OS_WIN) | ||
|
||
int main(int argc, char** argv) { | ||
This comment has been minimized.
Sorry, something went wrong.
bridiver
Collaborator
|
||
base::CommandLine::Init(argc, argv); | ||
size_t parallel_jobs = base::NumParallelJobs(); | ||
if (parallel_jobs == 0U) { | ||
return 1; | ||
} else if (parallel_jobs > 1U) { | ||
parallel_jobs /= 2U; | ||
} | ||
|
||
#if defined(OS_WIN) | ||
// Enable high-DPI for interactive tests where the user is expected to | ||
// manually verify results. | ||
if (base::CommandLine::ForCurrentProcess()->HasSwitch( | ||
switches::kTestLauncherInteractive)) { | ||
base::win::EnableHighDPISupport(); | ||
} | ||
#endif // defined(OS_WIN) | ||
|
||
ChromeTestSuiteRunner runner; | ||
BraveTestLauncherDelegate delegate(&runner); | ||
return LaunchChromeTests(parallel_jobs, &delegate, argc, argv); | ||
} |
there is something wrong here because this method should be behind a
!IS_ANDROID
flag, but it builds anyway like this so that means it isn't used during android tests or the build would break