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

Side by Side Diff: base/test/test_suite.cc

Issue 10690161: Make it possible to run gtests on iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@presubmit_change
Patch Set: Created 8 years, 5 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
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 #include "base/test/test_suite.h" 5 #include "base/test/test_suite.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/debug_on_start_win.h" 11 #include "base/debug/debug_on_start_win.h"
12 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/i18n/icu_util.h" 14 #include "base/i18n/icu_util.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/process_util.h" 18 #include "base/process_util.h"
19 #include "base/test/multiprocess_test.h" 19 #include "base/test/multiprocess_test.h"
20 #include "base/test/test_switches.h" 20 #include "base/test/test_switches.h"
21 #include "base/test/test_timeouts.h" 21 #include "base/test/test_timeouts.h"
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 #include "testing/multiprocess_func_list.h" 24 #include "testing/multiprocess_func_list.h"
25 25
26 #if defined(OS_MACOSX) 26 #if defined(OS_MACOSX)
27 #include "base/mac/scoped_nsautorelease_pool.h" 27 #include "base/mac/scoped_nsautorelease_pool.h"
28 #if !defined(OS_IOS) 28 #if !defined(OS_IOS)
stuartmorgan 2012/07/12 09:36:31 Reverse the order so it's note an if/else of a neg
leng 2012/07/12 10:44:42 Done.
29 #include "base/test/mock_chrome_application_mac.h" 29 #include "base/test/mock_chrome_application_mac.h"
30 #else // OS_IOS
31 #include "base/test/test_listener_ios.h"
30 #endif // !OS_IOS 32 #endif // !OS_IOS
31 #endif // OS_MACOSX 33 #endif // OS_MACOSX
32 34
33 #if defined(OS_ANDROID) 35 #if defined(OS_ANDROID)
34 #include "base/test/test_support_android.h" 36 #include "base/test/test_support_android.h"
35 #endif 37 #endif
36 38
37 #if defined(TOOLKIT_GTK) 39 #if defined(TOOLKIT_GTK)
38 #include <gtk/gtk.h> 40 #include <gtk/gtk.h>
39 #endif 41 #endif
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 #endif 229 #endif
228 230
229 Initialize(); 231 Initialize();
230 std::string client_func = 232 std::string client_func =
231 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 233 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
232 switches::kTestChildProcess); 234 switches::kTestChildProcess);
233 235
234 // Check to see if we are being run as a client process. 236 // Check to see if we are being run as a client process.
235 if (!client_func.empty()) 237 if (!client_func.empty())
236 return multi_process_function_list::InvokeChildProcessTest(client_func); 238 return multi_process_function_list::InvokeChildProcessTest(client_func);
239 #if defined(OS_IOS)
240 base::test_listener_ios::RegisterTestEndListener();
241 #endif
237 int result = RUN_ALL_TESTS(); 242 int result = RUN_ALL_TESTS();
238 243
239 // If there are failed tests, see if we should ignore the failures. 244 // If there are failed tests, see if we should ignore the failures.
240 if (result != 0 && GetTestCount(&TestSuite::NonIgnoredFailures) == 0) 245 if (result != 0 && GetTestCount(&TestSuite::NonIgnoredFailures) == 0)
241 result = 0; 246 result = 0;
242 247
243 // Display the number of flaky tests. 248 // Display the number of flaky tests.
244 int flaky_count = GetTestCount(&TestSuite::IsMarkedFlaky); 249 int flaky_count = GetTestCount(&TestSuite::IsMarkedFlaky);
245 if (flaky_count) { 250 if (flaky_count) {
246 printf(" YOU HAVE %d FLAKY %s\n\n", flaky_count, 251 printf(" YOU HAVE %d FLAKY %s\n\n", flaky_count,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 !CommandLine::ForCurrentProcess()->HasSwitch( 348 !CommandLine::ForCurrentProcess()->HasSwitch(
344 switches::kSingleProcessChromeFlag)) { 349 switches::kSingleProcessChromeFlag)) {
345 WatchAtExitManager(); 350 WatchAtExitManager();
346 } 351 }
347 352
348 TestTimeouts::Initialize(); 353 TestTimeouts::Initialize();
349 } 354 }
350 355
351 void TestSuite::Shutdown() { 356 void TestSuite::Shutdown() {
352 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698