Commit 9471d2a1 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr

Refactoring in unit_test_launcher.cc:

- expose RunUnitTestsSerially and RunUnitTestsBatch
- hide private static ProcessTestResults in anonymous namespace

This will be used to implement ios-specific unit test
relaunch logic. Exposing the helpers makes it possible
to re-use them in ios code.

BUG=426870
R=sky@chromium.org

Review URL: https://codereview.chromium.org/879883002

Cr-Commit-Position: refs/heads/master@{#313476}
parent 0d6e89ba
This diff is collapsed.
...@@ -59,6 +59,18 @@ class UnitTestPlatformDelegate { ...@@ -59,6 +59,18 @@ class UnitTestPlatformDelegate {
~UnitTestPlatformDelegate() {} ~UnitTestPlatformDelegate() {}
}; };
// Runs tests serially, each in its own process.
void RunUnitTestsSerially(TestLauncher* test_launcher,
UnitTestPlatformDelegate* platform_delegate,
const std::vector<std::string>& test_names,
int launch_flags);
// Runs tests in batches (each batch in its own process).
void RunUnitTestsBatch(TestLauncher* test_launcher,
UnitTestPlatformDelegate* platform_delegate,
const std::vector<std::string>& test_names,
int launch_flags);
// Test launcher delegate for unit tests (mostly to support batching). // Test launcher delegate for unit tests (mostly to support batching).
class UnitTestLauncherDelegate : public TestLauncherDelegate { class UnitTestLauncherDelegate : public TestLauncherDelegate {
public: public:
...@@ -68,15 +80,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { ...@@ -68,15 +80,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
~UnitTestLauncherDelegate() override; ~UnitTestLauncherDelegate() override;
private: private:
struct GTestCallbackState {
GTestCallbackState();
~GTestCallbackState();
TestLauncher* test_launcher;
std::vector<std::string> test_names;
FilePath output_file;
};
// TestLauncherDelegate: // TestLauncherDelegate:
bool GetTests(std::vector<SplitTestName>* output) override; bool GetTests(std::vector<SplitTestName>* output) override;
bool ShouldRunTest(const std::string& test_case_name, bool ShouldRunTest(const std::string& test_case_name,
...@@ -86,39 +89,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { ...@@ -86,39 +89,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
size_t RetryTests(TestLauncher* test_launcher, size_t RetryTests(TestLauncher* test_launcher,
const std::vector<std::string>& test_names) override; const std::vector<std::string>& test_names) override;
// Runs tests serially, each in its own process.
void RunSerially(TestLauncher* test_launcher,
const std::vector<std::string>& test_names);
// Runs tests in batches (each batch in its own process).
void RunBatch(TestLauncher* test_launcher,
const std::vector<std::string>& test_names);
// Callback for batched tests.
void GTestCallback(const GTestCallbackState& callback_state,
int exit_code,
const TimeDelta& elapsed_time,
bool was_timeout,
const std::string& output);
// Callback for serialized tests.
void SerialGTestCallback(const GTestCallbackState& callback_state,
const std::vector<std::string>& test_names,
int exit_code,
const TimeDelta& elapsed_time,
bool was_timeout,
const std::string& output);
// Interprets test results and reports to the test launcher. Returns true
// on success.
static bool ProcessTestResults(TestLauncher* test_launcher,
const std::vector<std::string>& test_names,
const base::FilePath& output_file,
const std::string& output,
int exit_code,
bool was_timeout,
std::vector<std::string>* tests_to_relaunch);
ThreadChecker thread_checker_; ThreadChecker thread_checker_;
UnitTestPlatformDelegate* platform_delegate_; UnitTestPlatformDelegate* platform_delegate_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment