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

Side by Side Diff: base/test/test_support_ios.mm

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « base/test/test_support_android.cc ('k') | base/threading/thread_checker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/message_loop/message_pump_default.h" 12 #include "base/message_loop/message_pump_default.h"
13 #include "base/test/test_suite.h" 13 #include "base/test/test_suite.h"
14 #include "testing/coverage_util_ios.h"
14 15
15 // Springboard will kill any iOS app that fails to check in after launch within 16 // Springboard will kill any iOS app that fails to check in after launch within
16 // a given time. Starting a UIApplication before invoking TestSuite::Run 17 // a given time. Starting a UIApplication before invoking TestSuite::Run
17 // prevents this from happening. 18 // prevents this from happening.
18 19
19 // InitIOSRunHook saves the TestSuite and argc/argv, then invoking 20 // InitIOSRunHook saves the TestSuite and argc/argv, then invoking
20 // RunTestsFromIOSApp calls UIApplicationMain(), providing an application 21 // RunTestsFromIOSApp calls UIApplicationMain(), providing an application
21 // delegate class: ChromeUnitTestDelegate. The delegate implements 22 // delegate class: ChromeUnitTestDelegate. The delegate implements
22 // application:didFinishLaunchingWithOptions: to invoke the TestSuite's Run 23 // application:didFinishLaunchingWithOptions: to invoke the TestSuite's Run
23 // method. 24 // method.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // TODO(ios): crbug.com/137010 Figure out how much time is actually needed, 159 // TODO(ios): crbug.com/137010 Figure out how much time is actually needed,
159 // and sleep only to make sure that much time has elapsed since launch. 160 // and sleep only to make sure that much time has elapsed since launch.
160 [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]]; 161 [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.0]];
161 window_.reset(); 162 window_.reset();
162 163
163 // Use the hidden selector to try and cleanly take down the app (otherwise 164 // Use the hidden selector to try and cleanly take down the app (otherwise
164 // things can think the app crashed even on a zero exit status). 165 // things can think the app crashed even on a zero exit status).
165 UIApplication* application = [UIApplication sharedApplication]; 166 UIApplication* application = [UIApplication sharedApplication];
166 [application _terminateWithStatus:exitStatus]; 167 [application _terminateWithStatus:exitStatus];
167 168
169 coverage_util::FlushCoverageDataIfNecessary();
170
168 exit(exitStatus); 171 exit(exitStatus);
169 } 172 }
170 173
171 @end 174 @end
172 175
173 namespace { 176 namespace {
174 177
175 scoped_ptr<base::MessagePump> CreateMessagePumpForUIForTests() { 178 scoped_ptr<base::MessagePump> CreateMessagePumpForUIForTests() {
176 // A default MessagePump will do quite nicely in tests. 179 // A default MessagePump will do quite nicely in tests.
177 return scoped_ptr<base::MessagePump>(new base::MessagePumpDefault()); 180 return scoped_ptr<base::MessagePump>(new base::MessagePumpDefault());
(...skipping 26 matching lines...) Expand all
204 if (!ran_hook) { 207 if (!ran_hook) {
205 ran_hook = true; 208 ran_hook = true;
206 mac::ScopedNSAutoreleasePool pool; 209 mac::ScopedNSAutoreleasePool pool;
207 int exit_status = UIApplicationMain(g_argc, g_argv, nil, 210 int exit_status = UIApplicationMain(g_argc, g_argv, nil,
208 @"ChromeUnitTestDelegate"); 211 @"ChromeUnitTestDelegate");
209 exit(exit_status); 212 exit(exit_status);
210 } 213 }
211 } 214 }
212 215
213 } // namespace base 216 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_support_android.cc ('k') | base/threading/thread_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698