| Index: ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
|
| diff --git a/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm b/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
|
| index ba8ad718d6db0397b0f208b5d5917c4317a0f85e..9a984b9f2106d899d2d371d1d0f90225d539a5fd 100644
|
| --- a/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
|
| +++ b/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
|
| @@ -23,12 +23,16 @@
|
| class AlertCoordinatorTest : public PlatformTest {
|
| protected:
|
| AlertCoordinatorTest() {
|
| + // Save the current key window and restore it after the test.
|
| + previous_key_window_ = [[UIApplication sharedApplication] keyWindow];
|
| window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
| [window_ makeKeyAndVisible];
|
| view_controller_ = [[UIViewController alloc] init];
|
| [window_ setRootViewController:view_controller_];
|
| }
|
|
|
| + ~AlertCoordinatorTest() override { [previous_key_window_ makeKeyAndVisible]; }
|
| +
|
| void startAlertCoordinator() { [alert_coordinator_ start]; }
|
|
|
| UIViewController* getViewController() { return view_controller_; }
|
| @@ -48,6 +52,7 @@ class AlertCoordinatorTest : public PlatformTest {
|
| }
|
|
|
| private:
|
| + UIWindow* previous_key_window_;
|
| AlertCoordinator* alert_coordinator_;
|
| UIWindow* window_;
|
| UIViewController* view_controller_;
|
|
|