OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <iostream> | 9 #include <iostream> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "chrome/common/ipc_tests.h" | 12 #include "chrome/common/ipc_tests.h" |
13 | 13 |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/debug_on_start.h" | 17 #include "base/debug_on_start.h" |
18 #include "base/perftimer.h" | 18 #include "base/perftimer.h" |
19 #include "base/process_util.h" | 19 #include "base/perf_test_suite.h" |
20 #include "base/scoped_nsautorelease_pool.h" | |
21 #include "base/test_suite.h" | 20 #include "base/test_suite.h" |
22 #include "base/thread.h" | 21 #include "base/thread.h" |
23 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
24 #include "chrome/common/ipc_channel.h" | 23 #include "chrome/common/ipc_channel.h" |
25 #include "chrome/common/ipc_channel_proxy.h" | 24 #include "chrome/common/ipc_channel_proxy.h" |
26 #include "chrome/common/ipc_message_utils.h" | 25 #include "chrome/common/ipc_message_utils.h" |
27 #include "testing/multiprocess_func_list.h" | 26 #include "testing/multiprocess_func_list.h" |
28 | 27 |
29 // Define to enable IPC performance testing instead of the regular unit tests | 28 // Define to enable IPC performance testing instead of the regular unit tests |
30 // #define PERFORMANCE_TEST | 29 // #define PERFORMANCE_TEST |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 ChannelReflectorListener channel_reflector_listener(&chan); | 427 ChannelReflectorListener channel_reflector_listener(&chan); |
429 chan.set_listener(&channel_reflector_listener); | 428 chan.set_listener(&channel_reflector_listener); |
430 chan.Connect(); | 429 chan.Connect(); |
431 | 430 |
432 MessageLoop::current()->Run(); | 431 MessageLoop::current()->Run(); |
433 return true; | 432 return true; |
434 } | 433 } |
435 | 434 |
436 #endif // PERFORMANCE_TEST | 435 #endif // PERFORMANCE_TEST |
437 | 436 |
438 #if defined(OS_WIN) | |
439 // All fatal log messages (e.g. DCHECK failures) imply unit test failures | |
440 static void IPCTestAssertHandler(const std::string& str) { | |
441 FAIL() << str; | |
442 } | |
443 | |
444 // Disable crash dialogs so that it doesn't gum up the buildbot | |
445 static void SuppressErrorDialogs() { | |
446 UINT new_flags = SEM_FAILCRITICALERRORS | | |
447 SEM_NOGPFAULTERRORBOX | | |
448 SEM_NOOPENFILEERRORBOX; | |
449 | |
450 // Preserve existing error mode, as discussed at http://t/dmea | |
451 UINT existing_flags = SetErrorMode(new_flags); | |
452 SetErrorMode(existing_flags | new_flags); | |
453 } | |
454 #endif // defined(OS_WIN) | |
455 | |
456 int main(int argc, char** argv) { | 437 int main(int argc, char** argv) { |
457 base::ScopedNSAutoreleasePool scoped_pool; | 438 #ifdef PERFORMANCE_TEST |
458 base::EnableTerminationOnHeapCorruption(); | 439 int retval = PerfTestSuite(argc, argv).Run(); |
459 | 440 #else |
460 #if defined(OS_WIN) | |
461 // suppress standard crash dialogs and such unless a debugger is present. | |
462 if (!IsDebuggerPresent()) { | |
463 SuppressErrorDialogs(); | |
464 logging::SetLogAssertHandler(IPCTestAssertHandler); | |
465 } | |
466 #endif // defined(OS_WIN) | |
467 | |
468 int retval = TestSuite(argc, argv).Run(); | 441 int retval = TestSuite(argc, argv).Run(); |
469 | |
470 #ifdef PERFORMANCE_TEST | |
471 if (!InitPerfLog("ipc_perf_child.log")) | |
472 return 1; | |
473 #endif | 442 #endif |
474 return retval; | 443 return retval; |
475 } | 444 } |
OLD | NEW |