Commit 8537d1c3 authored by lliabraa's avatar lliabraa Committed by Commit bot

Force-enable the software keyboard when running tests in iOS simulator.

Xcode 6 introduced behavior in the iOS Simulator where the software
keyboard does not appear if a hardware keyboard is connected.

This CL enables the software keyboard when a gtest app starts up.

BUG=392433

Review URL: https://codereview.chromium.org/514223002

Cr-Commit-Position: refs/heads/master@{#292916}
parent 2bba46ba
......@@ -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 // TARGET_IPHONE_SIMULATOR
@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 // TARGET_IPHONE_SIMULATOR
CGRect bounds = [[UIScreen mainScreen] bounds];
// Yes, this is leaked, it's just to make what's running visible.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment