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

Unified Diff: base/test/nslog_test_event_listener.h

Issue 12047058: Add NSLogTestEventListener to support running tests on iOS 6 devices. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: one arg per line in declaration or definitions Created 7 years, 11 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 | « base/base.gyp ('k') | base/test/nslog_test_event_listener.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/nslog_test_event_listener.h
diff --git a/base/test/nslog_test_event_listener.h b/base/test/nslog_test_event_listener.h
new file mode 100644
index 0000000000000000000000000000000000000000..91411f04c594f2564d5896f09ed8af73f31b62c1
--- /dev/null
+++ b/base/test/nslog_test_event_listener.h
@@ -0,0 +1,48 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TEST_NSLOG_TEST_EVENT_LISTENER_H_
+#define BASE_TEST_NSLOG_TEST_EVENT_LISTENER_H_
+
+#include "base/compiler_specific.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+@class NSString;
+
+// This class implements the TestEventListener interface so that output is
+// formatted like the PrettyUnitTestResultPrinter in gtest.cc, but writes to
+// NSLog instead of stdout (because, as of iOS 6, the app's stdout no longer
+// writes to the console log).
+class NSLogTestEventListener : public testing::TestEventListener {
+ public:
+ NSLogTestEventListener();
+
+ // TestEventListener overrides.
+ virtual void OnTestProgramStart(const testing::UnitTest&) OVERRIDE;
+ virtual void OnTestIterationStart(
+ const testing::UnitTest& unit_test,
+ int iteration) OVERRIDE;
+ virtual void OnEnvironmentsSetUpStart(
+ const testing::UnitTest& unit_test) OVERRIDE;
+ virtual void OnEnvironmentsSetUpEnd(const testing::UnitTest&) OVERRIDE;
+ virtual void OnTestCaseStart(const testing::TestCase& test_case) OVERRIDE;
+ virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE;
+ virtual void OnTestPartResult(const testing::TestPartResult& result) OVERRIDE;
+ virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE;
+ virtual void OnTestCaseEnd(const testing::TestCase& test_case) OVERRIDE;
+ virtual void OnEnvironmentsTearDownStart(
+ const testing::UnitTest& unit_test) OVERRIDE;
+ virtual void OnEnvironmentsTearDownEnd(const testing::UnitTest&) OVERRIDE;
+ virtual void OnTestIterationEnd(
+ const testing::UnitTest& unit_test,
+ int iteration) OVERRIDE;
+ virtual void OnTestProgramEnd(const testing::UnitTest&) OVERRIDE;
+
+ private:
+ static NSString* PrintFailedTests(const testing::UnitTest& unit_test);
+ static NSString* PrintFullTestCommentIfPresent(
+ const testing::TestInfo& test_info);
+};
+
+#endif // BASE_TEST_NSLOG_TEST_EVENT_LISTENER_H_
« no previous file with comments | « base/base.gyp ('k') | base/test/nslog_test_event_listener.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698