Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10180)

Unified Diff: base/test/test_launcher.h

Issue 17551010: GTTF: TestLauncher: asynchronous and out-of-order execution of tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/test/test_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_launcher.h
diff --git a/base/test/test_launcher.h b/base/test/test_launcher.h
index 720c74c2ca10a669f4308b2a26f91736abcf0315..866b7720cc51ce0ef82d1724cd9209ffd62cc95b 100644
--- a/base/test/test_launcher.h
+++ b/base/test/test_launcher.h
@@ -5,8 +5,12 @@
#ifndef BASE_TEST_TEST_LAUNCHER_H_
#define BASE_TEST_TEST_LAUNCHER_H_
+#include <string>
+
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "base/compiler_specific.h"
+#include "base/time.h"
namespace testing {
class TestCase;
@@ -22,6 +26,23 @@ extern const char kGTestRepeatFlag[];
extern const char kGTestRunDisabledTestsFlag[];
extern const char kGTestOutputFlag[];
+// Structure containing result of a single test.
+struct TestResult {
+ TestResult();
+
+ // Name of the test case (before the dot, e.g. "A" for test "A.B").
+ std::string test_case_name;
+
+ // Name of the test (after the dot, e.g. "B" for test "A.B").
+ std::string test_name;
+
+ // True if the test passed.
+ bool success;
+
+ // Time it took to run the test.
+ base::TimeDelta elapsed_time;
+};
+
// Interface for use with LaunchTests that abstracts away exact details
// which tests and how are run.
class TestLauncherDelegate {
@@ -32,10 +53,18 @@ class TestLauncherDelegate {
virtual bool ShouldRunTest(const testing::TestCase* test_case,
const testing::TestInfo* test_info) = 0;
- // Called to make the delegate run specified test. Should return true
- // on success.
- virtual bool RunTest(const testing::TestCase* test_case,
- const testing::TestInfo* test_info) = 0;
+ // Called to make the delegate run specified test. After the delegate
+ // finishes running the test (can do so asynchronously and out-of-order)
+ // it must call |callback| regardless of test success.
+ typedef base::Callback<void(const TestResult& result)> TestResultCallback;
+ virtual void RunTest(const testing::TestCase* test_case,
+ const testing::TestInfo* test_info,
+ const TestResultCallback& callback) = 0;
+
+ // If the delegate is running tests asynchronously, it must finish
+ // running all pending tests and call their callbacks before returning
+ // from this method.
+ virtual void RunRemainingTests() = 0;
protected:
virtual ~TestLauncherDelegate();
« no previous file with comments | « no previous file | base/test/test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698