Add |RTCUIApplicationStatusObserver sharedInstance| call in ios test AppDelegate.

We want to perform the observation setup as soon as possible to avoid deadlocking,
especially for test scenario where most of the work is done on main thread.

BUG=webrtc:6634

Review-Url: https://codereview.webrtc.org/3012913002
Cr-Original-Commit-Position: refs/heads/master@{#19771}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: d207a39d098259573f799aa5e6a1acff725b61a1
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 9ec0290..dc696c4 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -119,6 +119,9 @@
       "ios/test_support.h",
       "ios/test_support.mm",
     ]
+    deps = [
+      "../sdk:common_objc",
+    ]
   }
 }
 
diff --git a/test/ios/test_support.mm b/test/ios/test_support.mm
index 9a90356..a01b03c 100644
--- a/test/ios/test_support.mm
+++ b/test/ios/test_support.mm
@@ -12,6 +12,8 @@
 
 #include "webrtc/test/ios/test_support.h"
 
+#import "webrtc/sdk/objc/Framework/Classes/Common/RTCUIApplicationStatusObserver.h"
+
 // Springboard will kill any iOS app that fails to check in after launch within
 // a given time. Starting a UIApplication before invoking TestSuite::Run
 // prevents this from happening.
@@ -60,6 +62,11 @@
   // root view controller. Set an empty one here.
   [_window setRootViewController:[[UIViewController alloc] init]];
 
+  // We want to call `RTCUIApplicationStatusObserver sharedInstance` as early as
+  // possible in the application lifecycle to set observation properly.
+  __unused RTCUIApplicationStatusObserver *observer =
+      [RTCUIApplicationStatusObserver sharedInstance];
+
   // Queue up the test run.
   [self performSelector:@selector(runTests) withObject:nil afterDelay:0.1];
   return YES;