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 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
6 | 6 |
7 #include "base/multiprocess_test.h" | 7 #include "base/multiprocess_test.h" |
8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <windows.h> | 12 #include <windows.h> |
13 #elif defined(OS_LINUX) | 13 #elif defined(OS_LINUX) |
14 #include <dlfcn.h> | 14 #include <dlfcn.h> |
15 #endif | 15 #endif |
16 | 16 |
17 namespace { | 17 namespace { |
18 class ProcessUtilTest : public MultiProcessTest { | 18 class ProcessUtilTest : public MultiProcessTest { |
19 }; | 19 }; |
20 } | |
21 | 20 |
22 extern "C" int DYNAMIC_EXPORT SimpleChildProcess() { | 21 MULTIPROCESS_TEST_MAIN(SimpleChildProcess) { |
23 return 0; | 22 return 0; |
24 } | 23 } |
25 | 24 |
26 TEST_F(ProcessUtilTest, SpawnChild) { | 25 TEST_F(ProcessUtilTest, SpawnChild) { |
27 ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); | 26 ProcessHandle handle = this->SpawnChild(L"SimpleChildProcess"); |
28 | 27 |
29 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); | 28 ASSERT_NE(static_cast<ProcessHandle>(NULL), handle); |
30 EXPECT_TRUE(process_util::WaitForSingleProcess(handle, 1000)); | 29 EXPECT_TRUE(process_util::WaitForSingleProcess(handle, 1000)); |
31 } | 30 } |
32 | 31 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 EXPECT_GE(free_mem2.total, free_mem2.largest); | 91 EXPECT_GE(free_mem2.total, free_mem2.largest); |
93 EXPECT_GE(expected_total, free_mem2.total); | 92 EXPECT_GE(expected_total, free_mem2.total); |
94 EXPECT_GE(expected_largest, free_mem2.largest); | 93 EXPECT_GE(expected_largest, free_mem2.largest); |
95 EXPECT_TRUE(NULL != free_mem2.largest_ptr); | 94 EXPECT_TRUE(NULL != free_mem2.largest_ptr); |
96 | 95 |
97 delete[] alloc; | 96 delete[] alloc; |
98 delete metrics; | 97 delete metrics; |
99 } | 98 } |
100 #endif // defined(OS_WIN) | 99 #endif // defined(OS_WIN) |
101 | 100 |
| 101 } // namespace |
OLD | NEW |