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 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/multiprocess_test.h" | 6 #include "base/multiprocess_test.h" |
7 #include "base/platform_thread.h" | 7 #include "base/platform_thread.h" |
8 #include "base/scoped_nsautorelease_pool.h" | 8 #include "base/scoped_nsautorelease_pool.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 311 } |
312 | 312 |
313 memory.Close(); | 313 memory.Close(); |
314 return errors; | 314 return errors; |
315 } | 315 } |
316 | 316 |
317 private: | 317 private: |
318 static const wchar_t* const s_test_name_; | 318 static const wchar_t* const s_test_name_; |
319 }; | 319 }; |
320 | 320 |
321 const const wchar_t* const SharedMemoryProcessTest::s_test_name_ = L"MPMem"; | 321 const wchar_t* const SharedMemoryProcessTest::s_test_name_ = L"MPMem"; |
322 | 322 |
323 | 323 |
324 TEST_F(SharedMemoryProcessTest, Tasks) { | 324 TEST_F(SharedMemoryProcessTest, Tasks) { |
325 SharedMemoryProcessTest::CleanUp(); | 325 SharedMemoryProcessTest::CleanUp(); |
326 | 326 |
327 base::ProcessHandle handles[kNumTasks]; | 327 base::ProcessHandle handles[kNumTasks]; |
328 for (int index = 0; index < kNumTasks; ++index) { | 328 for (int index = 0; index < kNumTasks; ++index) { |
329 handles[index] = SpawnChild(L"SharedMemoryTestMain"); | 329 handles[index] = SpawnChild(L"SharedMemoryTestMain"); |
330 } | 330 } |
331 | 331 |
332 int exit_code = 0; | 332 int exit_code = 0; |
333 for (int index = 0; index < kNumTasks; ++index) { | 333 for (int index = 0; index < kNumTasks; ++index) { |
334 EXPECT_TRUE(base::WaitForExitCode(handles[index], &exit_code)); | 334 EXPECT_TRUE(base::WaitForExitCode(handles[index], &exit_code)); |
335 EXPECT_TRUE(exit_code == 0); | 335 EXPECT_TRUE(exit_code == 0); |
336 } | 336 } |
337 | 337 |
338 SharedMemoryProcessTest::CleanUp(); | 338 SharedMemoryProcessTest::CleanUp(); |
339 } | 339 } |
340 | 340 |
341 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { | 341 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { |
342 return SharedMemoryProcessTest::TaskTestMain(); | 342 return SharedMemoryProcessTest::TaskTestMain(); |
343 } | 343 } |
344 | 344 |
345 | 345 |
346 } // namespace base | 346 } // namespace base |
OLD | NEW |