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

Unified Diff: ios/chrome/browser/ui/context_menu/context_menu_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 | « ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
diff --git a/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm b/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
index be724fc1061b4d592532a5f05a004019c121d9a1..5ef3dac4a8d6663f3e6ed7a6983f09b8711ca4a7 100644
--- a/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
+++ b/ios/chrome/browser/ui/context_menu/context_menu_coordinator_unittest.mm
@@ -16,6 +16,9 @@
class ContextMenuCoordinatorTest : public PlatformTest {
public:
ContextMenuCoordinatorTest() {
+ // Save the current key window and restore it after the test.
+ previous_key_window_.reset(
+ [[[UIApplication sharedApplication] keyWindow] retain]);
window_.reset(
[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
[window_ makeKeyAndVisible];
@@ -23,7 +26,12 @@ class ContextMenuCoordinatorTest : public PlatformTest {
[window_ setRootViewController:view_controller_];
}
+ ~ContextMenuCoordinatorTest() override {
+ [previous_key_window_ makeKeyAndVisible];
+ }
+
protected:
+ base::scoped_nsobject<UIWindow> previous_key_window_;
base::scoped_nsobject<ContextMenuCoordinator> menu_coordinator_;
base::scoped_nsobject<UIWindow> window_;
base::scoped_nsobject<UIViewController> view_controller_;
« no previous file with comments | « ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698