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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 window_.reset([[UIWindow alloc] initWithFrame:bounds]); | 73 window_.reset([[UIWindow alloc] initWithFrame:bounds]); |
74 [window_ setBackgroundColor:[UIColor whiteColor]]; | 74 [window_ setBackgroundColor:[UIColor whiteColor]]; |
75 [window_ makeKeyAndVisible]; | 75 [window_ makeKeyAndVisible]; |
76 | 76 |
77 // Add a label with the app name. | 77 // Add a label with the app name. |
78 UILabel* label = [[[UILabel alloc] initWithFrame:bounds] autorelease]; | 78 UILabel* label = [[[UILabel alloc] initWithFrame:bounds] autorelease]; |
79 label.text = [[NSProcessInfo processInfo] processName]; | 79 label.text = [[NSProcessInfo processInfo] processName]; |
80 label.textAlignment = NSTextAlignmentCenter; | 80 label.textAlignment = NSTextAlignmentCenter; |
81 [window_ addSubview:label]; | 81 [window_ addSubview:label]; |
82 | 82 |
| 83 // An NSInternalInconsistencyException is thrown if the app doesn't have a |
| 84 // root view controller. Set an empty one here. |
| 85 [window_ setRootViewController:[[[UIViewController alloc] init] autorelease]]; |
| 86 |
83 if ([self shouldRedirectOutputToFile]) | 87 if ([self shouldRedirectOutputToFile]) |
84 [self redirectOutput]; | 88 [self redirectOutput]; |
85 | 89 |
86 // Queue up the test run. | 90 // Queue up the test run. |
87 [self performSelector:@selector(runTests) | 91 [self performSelector:@selector(runTests) |
88 withObject:nil | 92 withObject:nil |
89 afterDelay:0.1]; | 93 afterDelay:0.1]; |
90 return YES; | 94 return YES; |
91 } | 95 } |
92 | 96 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (!ran_hook) { | 211 if (!ran_hook) { |
208 ran_hook = true; | 212 ran_hook = true; |
209 mac::ScopedNSAutoreleasePool pool; | 213 mac::ScopedNSAutoreleasePool pool; |
210 int exit_status = UIApplicationMain(g_argc, g_argv, nil, | 214 int exit_status = UIApplicationMain(g_argc, g_argv, nil, |
211 @"ChromeUnitTestDelegate"); | 215 @"ChromeUnitTestDelegate"); |
212 exit(exit_status); | 216 exit(exit_status); |
213 } | 217 } |
214 } | 218 } |
215 | 219 |
216 } // namespace base | 220 } // namespace base |
OLD | NEW |