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

Unified Diff: ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm

Issue 2588223002: [ios] Restore the original key window at the end of the AlertCoordinator tests. (Closed)
Patch Set: One more test. Created 4 years 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 | « no previous file | ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698