OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 message_loop_ = new MessageLoopForIO(); | 54 message_loop_ = new MessageLoopForIO(); |
55 } | 55 } |
56 | 56 |
57 void IPCChannelTest::TearDown() { | 57 void IPCChannelTest::TearDown() { |
58 delete message_loop_; | 58 delete message_loop_; |
59 message_loop_ = NULL; | 59 message_loop_ = NULL; |
60 | 60 |
61 MultiProcessTest::TearDown(); | 61 MultiProcessTest::TearDown(); |
62 } | 62 } |
63 | 63 |
| 64 #define PRINT_FOR_SURE(a) LOG(INFO) << a; printf("%s\n", a); fprintf(stderr, "%s
\n", a); |
| 65 bool return_true() { |
| 66 PRINT_FOR_SURE("return_true was called"); |
| 67 return true; |
| 68 } |
| 69 |
| 70 TEST_F(IPCChannelTest, DCHECK_TEST) { |
| 71 #ifdef NDEBUG |
| 72 PRINT_FOR_SURE("NDEBUG is defined"); |
| 73 #else |
| 74 PRINT_FOR_SURE("NDEBUG is not defined"); |
| 75 #endif |
| 76 DCHECK(return_true()); |
| 77 } |
| 78 |
| 79 void DeathFunction() { |
| 80 DCHECK(!return_true()); |
| 81 } |
| 82 |
| 83 TEST_F(IPCChannelTest, DeathTest) { |
| 84 //::testing::FLAGS_gtest_death_test_style = "threadsafe"; |
| 85 ASSERT_DEATH_IF_SUPPORTED(DeathFunction(), ""); |
| 86 } |
| 87 |
64 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
65 base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type, | 89 base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type, |
66 IPC::Channel *channel) { | 90 IPC::Channel *channel) { |
67 // kDebugChildren support. | 91 // kDebugChildren support. |
68 bool debug_on_start = | 92 bool debug_on_start = |
69 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugChildren); | 93 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDebugChildren); |
70 | 94 |
71 switch (child_type) { | 95 switch (child_type) { |
72 case TEST_CLIENT: | 96 case TEST_CLIENT: |
73 return MultiProcessTest::SpawnChild(L"RunTestClient", debug_on_start); | 97 return MultiProcessTest::SpawnChild(L"RunTestClient", debug_on_start); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 #endif // PERFORMANCE_TEST | 558 #endif // PERFORMANCE_TEST |
535 | 559 |
536 int main(int argc, char** argv) { | 560 int main(int argc, char** argv) { |
537 #ifdef PERFORMANCE_TEST | 561 #ifdef PERFORMANCE_TEST |
538 int retval = PerfTestSuite(argc, argv).Run(); | 562 int retval = PerfTestSuite(argc, argv).Run(); |
539 #else | 563 #else |
540 int retval = TestSuite(argc, argv).Run(); | 564 int retval = TestSuite(argc, argv).Run(); |
541 #endif | 565 #endif |
542 return retval; | 566 return retval; |
543 } | 567 } |
OLD | NEW |