diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-10-26 14:01:57 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-10-26 15:12:53 +1000 |
commit | 800a2a43c9c620e49147b29c6c4d08e6efb3d5ce (patch) | |
tree | eae1aef0c30a5087bf4470e93d3f4563c22837c6 | |
parent | 7a3deaca73b77b6db615a01ab875fdc667611f3b (diff) |
common: make video driver test subclass of XITServerTest too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tests/common/video-driver-test.cpp | 28 | ||||
-rw-r--r-- | tests/common/video-driver-test.h | 44 |
2 files changed, 3 insertions, 69 deletions
diff --git a/tests/common/video-driver-test.cpp b/tests/common/video-driver-test.cpp index e929c6c..33cb53a 100644 --- a/tests/common/video-driver-test.cpp +++ b/tests/common/video-driver-test.cpp @@ -22,13 +22,6 @@ void VideoDriverTest::SetUpConfigAndLog(const std::string& param) { config.WriteConfig(); } -void VideoDriverTest::SetUpEventListener() { - failed = false; - - testing::TestEventListeners &listeners = ::testing::UnitTest::GetInstance()->listeners(); - listeners.Append(this); -} - void VideoDriverTest::SetUp() { SetUp(""); } @@ -39,24 +32,3 @@ void VideoDriverTest::SetUp(const std::string ¶m) { StartServer(); } -void VideoDriverTest::TearDown() { - if (server.Pid() != -1) - if (!server.Terminate(3000)) - server.Kill(3000); - - if (!Failed()) { - config.RemoveConfig(); - server.RemoveLogFile(); - } - - testing::TestEventListeners &listeners = ::testing::UnitTest::GetInstance()->listeners(); - listeners.Release(this); -} - -void VideoDriverTest::OnTestPartResult(const ::testing::TestPartResult &test_part_result) { - failed = test_part_result.failed(); -} - -bool VideoDriverTest::Failed() { - return failed; -} diff --git a/tests/common/video-driver-test.h b/tests/common/video-driver-test.h index 59047fc..e3db0aa 100644 --- a/tests/common/video-driver-test.h +++ b/tests/common/video-driver-test.h @@ -5,7 +5,8 @@ #define _VIDEO_DRIVER_TEST_H_ #include <xorg/gtest/xorg-gtest.h> -#include "xorg-conf.h" + +#include "xit-server-test.h" /** * A test fixture for testing Video drivers. This class automates basic @@ -14,8 +15,7 @@ * Do not instanciate this class directly, subclass it from the test case * instead. For simple test cases, use SimpleVideoDriverTest. */ -class VideoDriverTest : public xorg::testing::Test, - private ::testing::EmptyTestEventListener { +class VideoDriverTest : public XITServerTest { protected: /** * Set up the config and log file. The param is used for both the @@ -33,12 +33,6 @@ protected: virtual void SetUpConfigAndLog(const std::string& param = ""); /** - * Set up an event listener that listens for test results. If any result - * fails, Failed() will return true. - */ - void SetUpEventListener(); - - /** * Starts the server and waits for connections. Once completed, * xorg::testing::Test::Display() will be set to the server's display * and that display will have registered for XI2. @@ -61,38 +55,6 @@ protected: */ virtual void SetUp(const std::string ¶m); - /** - * Default googletest entry point for clean-up work after test - * fixtures were run. - */ - virtual void TearDown(); - - /** - * @return false if all tests succeeded, true if one failed - */ - virtual bool Failed(); - - /** - * The X server instance. This server is started with StartServer() but - * may be started by child classes directly. - */ - xorg::testing::XServer server; - - /** - * The server configuration. SetUpConfigAndLog() by default works on - * this configuration and the server started by StartServer() will then - * use this configuration. - */ - XOrgConfig config; - -private: - bool failed; - - /** - * Callback for test results. If any test fails, ::Failed() will return - * false. - */ - void OnTestPartResult(const ::testing::TestPartResult &test_part_result); }; /** |