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 |