| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <UIKit/UIKit.h> | 5 #import <UIKit/UIKit.h> |
| 6 | 6 |
| 7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/scoped_nsautorelease_pool.h" | 9 #include "base/mac/scoped_nsautorelease_pool.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // run in a row, this provides an indication of which one is currently running. | 27 // run in a row, this provides an indication of which one is currently running. |
| 28 | 28 |
| 29 static base::TestSuite* g_test_suite = NULL; | 29 static base::TestSuite* g_test_suite = NULL; |
| 30 static int g_argc; | 30 static int g_argc; |
| 31 static char** g_argv; | 31 static char** g_argv; |
| 32 | 32 |
| 33 @interface UIApplication (Testing) | 33 @interface UIApplication (Testing) |
| 34 - (void) _terminateWithStatus:(int)status; | 34 - (void) _terminateWithStatus:(int)status; |
| 35 @end | 35 @end |
| 36 | 36 |
| 37 #ifdef TARGET_IPHONE_SIMULATOR | 37 #if TARGET_IPHONE_SIMULATOR |
| 38 // Xcode 6 introduced behavior in the iOS Simulator where the software | 38 // Xcode 6 introduced behavior in the iOS Simulator where the software |
| 39 // keyboard does not appear if a hardware keyboard is connected. The following | 39 // keyboard does not appear if a hardware keyboard is connected. The following |
| 40 // declaration allows this behavior to be overriden when the app starts up. | 40 // declaration allows this behavior to be overriden when the app starts up. |
| 41 @interface UIKeyboardImpl | 41 @interface UIKeyboardImpl |
| 42 + (instancetype)sharedInstance; | 42 + (instancetype)sharedInstance; |
| 43 - (void)setAutomaticMinimizationEnabled:(BOOL)enabled; | 43 - (void)setAutomaticMinimizationEnabled:(BOOL)enabled; |
| 44 - (void)setSoftwareKeyboardShownByTouch:(BOOL)enabled; | 44 - (void)setSoftwareKeyboardShownByTouch:(BOOL)enabled; |
| 45 @end | 45 @end |
| 46 #endif // TARGET_IPHONE_SIMULATOR | 46 #endif // TARGET_IPHONE_SIMULATOR |
| 47 | 47 |
| 48 @interface ChromeUnitTestDelegate : NSObject { | 48 @interface ChromeUnitTestDelegate : NSObject { |
| 49 @private | 49 @private |
| 50 base::scoped_nsobject<UIWindow> window_; | 50 base::scoped_nsobject<UIWindow> window_; |
| 51 } | 51 } |
| 52 - (void)runTests; | 52 - (void)runTests; |
| 53 @end | 53 @end |
| 54 | 54 |
| 55 @implementation ChromeUnitTestDelegate | 55 @implementation ChromeUnitTestDelegate |
| 56 | 56 |
| 57 - (BOOL)application:(UIApplication *)application | 57 - (BOOL)application:(UIApplication *)application |
| 58 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | 58 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
| 59 | 59 |
| 60 #ifdef TARGET_IPHONE_SIMULATOR | 60 #if TARGET_IPHONE_SIMULATOR |
| 61 // Xcode 6 introduced behavior in the iOS Simulator where the software | 61 // Xcode 6 introduced behavior in the iOS Simulator where the software |
| 62 // keyboard does not appear if a hardware keyboard is connected. The following | 62 // keyboard does not appear if a hardware keyboard is connected. The following |
| 63 // calls override this behavior by ensuring that the software keyboard is | 63 // calls override this behavior by ensuring that the software keyboard is |
| 64 // always shown. | 64 // always shown. |
| 65 [[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO]; | 65 [[UIKeyboardImpl sharedInstance] setAutomaticMinimizationEnabled:NO]; |
| 66 [[UIKeyboardImpl sharedInstance] setSoftwareKeyboardShownByTouch:YES]; | 66 [[UIKeyboardImpl sharedInstance] setSoftwareKeyboardShownByTouch:YES]; |
| 67 #endif // TARGET_IPHONE_SIMULATOR | 67 #endif // TARGET_IPHONE_SIMULATOR |
| 68 | 68 |
| 69 CGRect bounds = [[UIScreen mainScreen] bounds]; | 69 CGRect bounds = [[UIScreen mainScreen] bounds]; |
| 70 | 70 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (!ran_hook) { | 203 if (!ran_hook) { |
| 204 ran_hook = true; | 204 ran_hook = true; |
| 205 mac::ScopedNSAutoreleasePool pool; | 205 mac::ScopedNSAutoreleasePool pool; |
| 206 int exit_status = UIApplicationMain(g_argc, g_argv, nil, | 206 int exit_status = UIApplicationMain(g_argc, g_argv, nil, |
| 207 @"ChromeUnitTestDelegate"); | 207 @"ChromeUnitTestDelegate"); |
| 208 exit(exit_status); | 208 exit(exit_status); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace base | 212 } // namespace base |
| OLD | NEW |