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

Unified Diff: base/test/test_support_ios.mm

Issue 514223002: Force-enable the software keyboard when running tests in iOS simulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_support_ios.mm
diff --git a/base/test/test_support_ios.mm b/base/test/test_support_ios.mm
index 0d9b0379b9b84ae7871c29d674ce53aa5833861c..0b6d068745caa710056a5112163ba561b4303cf1 100644
--- a/base/test/test_support_ios.mm
+++ b/base/test/test_support_ios.mm
@@ -34,6 +34,17 @@ static char** g_argv;
- (void) _terminateWithStatus:(int)status;
@end
+#ifdef TARGET_IPHONE_SIMULATOR
+// Xcode 6 introduced behavior in the iOS Simulator where the software
+// keyboard does not appear if a hardware keyboard is connected. The following
+// declaration allows this behavior to be overriden when the app starts up.
+@interface UIKeyboardImpl
++ (instancetype)sharedInstance;
+- (void)setAutomaticMinimizationEnabled:(BOOL)enabled;
+- (void)setSoftwareKeyboardShownByTouch:(BOOL)enabled;
+@end
+#endif
Paweł Hajdan Jr. 2014/08/29 09:48:29 nit: // ifdef TARGET_IPHONE_SIMULATOR
lliabraa 2014/09/02 12:46:22 Done.
+
@interface ChromeUnitTestDelegate : NSObject {
@private
base::scoped_nsobject<UIWindow> window_;
@@ -46,6 +57,15 @@ static char** g_argv;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+#ifdef TARGET_IPHONE_SIMULATOR
+ // Xcode 6 introduced behavior in the iOS Simulator where the software
+ // keyboard does not appear if a hardware keyboard is connected. The following
+ // calls override this behavior by ensuring that the software keyboard is
+ // always shown.
+ [[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO];
+ [[UIKeyboardImpl sharedInstance] setSoftwareKeyboardShownByTouch:YES];
+#endif
Paweł Hajdan Jr. 2014/08/29 09:48:29 nit: // ifdef TARGET_IPHONE_SIMULATOR
lliabraa 2014/09/02 12:46:22 Done.
+
CGRect bounds = [[UIScreen mainScreen] bounds];
// Yes, this is leaked, it's just to make what's running visible.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698