diff options
author | lliabraa <lliabraa@chromium.org> | 2014-09-02 06:41:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-02 13:42:45 +0000 |
commit | 8537d1c315ae011220153e68a9017fedabb9bdea (patch) | |
tree | c2c709b8de844cfc0341f696914f848a3ac85b33 /base | |
parent | 2bba46ba48234adef8459617fffbc93786b14953 (diff) | |
download | chromium_src-8537d1c315ae011220153e68a9017fedabb9bdea.zip chromium_src-8537d1c315ae011220153e68a9017fedabb9bdea.tar.gz chromium_src-8537d1c315ae011220153e68a9017fedabb9bdea.tar.bz2 |
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}
Diffstat (limited to 'base')
-rw-r--r-- | base/test/test_support_ios.mm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/base/test/test_support_ios.mm b/base/test/test_support_ios.mm index 0d9b037..cbc6465d 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 // 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. |