Create a UIApplication when running tests on iOS.

Fix issue where running tests on iOS would get killed after a certain
time had passed. This seems to be due to springboard killing apps
that don't have a GUI running. Creating a UIApplication to wrap
the test suite seems to solve this problem in chromium.

This CL adds a class for this purpose. Most of the code was copied
from chromium with bits taken out.

Bug: webrtc:7161, webrtc:7758
Change-Id: I10f9bc8914e73f2870a9b0a2703cde496af8db2f
Reviewed-on: https://chromium-review.googlesource.com/528173
Reviewed-by: Henrik Andreasson <henrika@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Kári Tristan Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18509}
diff --git a/webrtc/base/unittest_main.cc b/webrtc/base/unittest_main.cc
index 1600217..90304d6 100644
--- a/webrtc/base/unittest_main.cc
+++ b/webrtc/base/unittest_main.cc
@@ -23,6 +23,10 @@
 #include "webrtc/test/field_trial.h"
 #include "webrtc/test/testsupport/fileutils.h"
 
+#if defined(WEBRTC_IOS)
+#include "webrtc/test/ios/test_support.h"
+#endif
+
 DEFINE_bool(help, false, "prints this message");
 DEFINE_string(log, "", "logging options to use");
 DEFINE_string(
@@ -106,7 +110,11 @@
   rtc::InitializeSSL();
   rtc::SSLStreamAdapter::enable_time_callback_for_testing();
 
-  int res = RUN_ALL_TESTS();
+#if defined(WEBRTC_IOS)
+  rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
+  rtc::test::RunTestsFromIOSApp();
+#endif
+  const int res = RUN_ALL_TESTS();
 
   rtc::CleanupSSL();