OLD | NEW |
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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include <sys/stat.h> | 26 #include <sys/stat.h> |
27 #include <sys/types.h> | 27 #include <sys/types.h> |
28 #include <unistd.h> | 28 #include <unistd.h> |
29 #endif | 29 #endif |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" |
33 #endif | 33 #endif |
34 | 34 |
35 static const int kNumThreads = 5; | 35 static const int kNumThreads = 5; |
| 36 #if !defined(OS_IOS) // iOS does not allow multiple processes. |
36 static const int kNumTasks = 5; | 37 static const int kNumTasks = 5; |
| 38 #endif |
37 | 39 |
38 namespace base { | 40 namespace base { |
39 | 41 |
40 namespace { | 42 namespace { |
41 | 43 |
42 // Each thread will open the shared memory. Each thread will take a different 4 | 44 // Each thread will open the shared memory. Each thread will take a different 4 |
43 // byte int pointer, and keep changing it, with some small pauses in between. | 45 // byte int pointer, and keep changing it, with some small pauses in between. |
44 // Verify that each thread's value in the shared memory is always correct. | 46 // Verify that each thread's value in the shared memory is always correct. |
45 class MultipleThreadMain : public PlatformThread::Delegate { | 47 class MultipleThreadMain : public PlatformThread::Delegate { |
46 public: | 48 public: |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 SharedMemoryProcessTest::CleanUp(); | 659 SharedMemoryProcessTest::CleanUp(); |
658 } | 660 } |
659 | 661 |
660 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { | 662 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { |
661 return SharedMemoryProcessTest::TaskTestMain(); | 663 return SharedMemoryProcessTest::TaskTestMain(); |
662 } | 664 } |
663 | 665 |
664 #endif // !OS_IOS | 666 #endif // !OS_IOS |
665 | 667 |
666 } // namespace base | 668 } // namespace base |
OLD | NEW |