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

Unified Diff: base/test/test_listener_ios.mm

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/test/test_listener_ios.h ('k') | base/test/test_suite.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_listener_ios.mm
diff --git a/base/test/test_listener_ios.mm b/base/test/test_listener_ios.mm
index 12cf5bb9ebaaf3a9a5b3a7d719de431e16f3976d..b3399a571b9d23676939570e498761479861b201 100644
--- a/base/test/test_listener_ios.mm
+++ b/base/test/test_listener_ios.mm
@@ -6,7 +6,9 @@
#import <Foundation/Foundation.h>
+#include "base/ios/ios_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/test/nslog_test_event_listener.h"
#include "testing/gtest/include/gtest/gtest.h"
// The iOS watchdog timer will kill an app that doesn't spin the main event
@@ -41,5 +43,18 @@ void RegisterTestEndListener() {
listeners.Append(new IOSRunLoopListener);
}
+// Only add the NSLogTestEventListener when running on a device with iOS 6 or
+// later.
+void RegisterNSLogListenerIfNecessary() {
+#if !TARGET_IPHONE_SIMULATOR
+ NSLog(@"Running on a device");
+ if (ios::IsRunningOnIOS6OrLater()) {
+ testing::TestEventListeners& listeners =
+ testing::UnitTest::GetInstance()->listeners();
+ listeners.Append(new NSLogTestEventListener);
+ }
+#endif
+}
+
} // namespace test_listener_ios
} // namespace base
« no previous file with comments | « base/test/test_listener_ios.h ('k') | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698