summaryrefslogtreecommitdiff
path: root/test/gtest-listener_test.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-09-24 21:15:59 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-09-24 21:15:59 +0000
commitfff033497b70e96a5dcadb6ba9570c12b5921d74 (patch)
treeceb0f9819c41f511d74cf72066ec48620dea8caa /test/gtest-listener_test.cc
parent9c54fe88bc2b5d03bb9594b0c8f5ad1e0b905996 (diff)
downloadgoogletest-fff033497b70e96a5dcadb6ba9570c12b5921d74.tar.gz
Publishes the even listener API (by Vlad Losev); adds OS-indicating macros to simplify gtest code (by Zhanyong Wan).
git-svn-id: http://googletest.googlecode.com/svn/trunk@320 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest-listener_test.cc')
-rw-r--r--test/gtest-listener_test.cc23
1 files changed, 6 insertions, 17 deletions
diff --git a/test/gtest-listener_test.cc b/test/gtest-listener_test.cc
index 95ff0b1..f12f518 100644
--- a/test/gtest-listener_test.cc
+++ b/test/gtest-listener_test.cc
@@ -48,12 +48,12 @@ using ::testing::AddGlobalTestEnvironment;
using ::testing::Environment;
using ::testing::InitGoogleTest;
using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListener;
using ::testing::TestInfo;
using ::testing::TestPartResult;
using ::testing::UnitTest;
using ::testing::internal::String;
-using ::testing::internal::TestCase;
-using ::testing::internal::UnitTestEventListenerInterface;
using ::testing::internal::Vector;
// Used by tests to register their events.
@@ -62,17 +62,7 @@ Vector<String>* g_events = NULL;
namespace testing {
namespace internal {
-// TODO(vladl@google.com): Remove this and use UnitTest::listeners()
-// directly after it is published.
-class UnitTestAccessor {
- public:
- static EventListeners& GetEventListeners() {
- return UnitTest::GetInstance()->listeners();
- }
- static bool UnitTestFailed() { return UnitTest::GetInstance()->Failed(); }
-};
-
-class EventRecordingListener : public UnitTestEventListenerInterface {
+class EventRecordingListener : public TestEventListener {
public:
EventRecordingListener(const char* name) : name_(name) {}
@@ -195,7 +185,6 @@ TEST_F(ListenerTest, DoesBar) {
using ::testing::internal::EnvironmentInvocationCatcher;
using ::testing::internal::EventRecordingListener;
-using ::testing::internal::UnitTestAccessor;
void VerifyResults(const Vector<String>& data,
const char* const* expected_data,
@@ -225,9 +214,9 @@ int main(int argc, char **argv) {
g_events = &events;
InitGoogleTest(&argc, argv);
- UnitTestAccessor::GetEventListeners().Append(
+ UnitTest::GetInstance()->listeners().Append(
new EventRecordingListener("1st"));
- UnitTestAccessor::GetEventListeners().Append(
+ UnitTest::GetInstance()->listeners().Append(
new EventRecordingListener("2nd"));
AddGlobalTestEnvironment(new EnvironmentInvocationCatcher);
@@ -326,7 +315,7 @@ int main(int argc, char **argv) {
// We need to check manually for ad hoc test failures that happen after
// RUN_ALL_TESTS finishes.
- if (UnitTestAccessor::UnitTestFailed())
+ if (UnitTest::GetInstance()->Failed())
ret_val = 1;
return ret_val;