Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: base/memory/shared_memory_unittest.cc

Issue 1092863002: Apply automated fixits for Chrome clang plugin to base_unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix format Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/logging_win.h ('k') | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // This test requires the ability to pass file descriptors between processes. 94 // This test requires the ability to pass file descriptors between processes.
95 // We haven't done that yet in Chrome for POSIX. 95 // We haven't done that yet in Chrome for POSIX.
96 #if defined(OS_WIN) 96 #if defined(OS_WIN)
97 // Each thread will open the shared memory. Each thread will take the memory, 97 // Each thread will open the shared memory. Each thread will take the memory,
98 // and keep changing it while trying to lock it, with some small pauses in 98 // and keep changing it while trying to lock it, with some small pauses in
99 // between. Verify that each thread's value in the shared memory is always 99 // between. Verify that each thread's value in the shared memory is always
100 // correct. 100 // correct.
101 class MultipleLockThread : public PlatformThread::Delegate { 101 class MultipleLockThread : public PlatformThread::Delegate {
102 public: 102 public:
103 explicit MultipleLockThread(int id) : id_(id) {} 103 explicit MultipleLockThread(int id) : id_(id) {}
104 virtual ~MultipleLockThread() {} 104 ~MultipleLockThread() override {}
105 105
106 // PlatformThread::Delegate interface. 106 // PlatformThread::Delegate interface.
107 virtual void ThreadMain() override { 107 void ThreadMain() override {
108 const uint32 kDataSize = sizeof(int); 108 const uint32 kDataSize = sizeof(int);
109 SharedMemoryHandle handle = NULL; 109 SharedMemoryHandle handle = NULL;
110 { 110 {
111 SharedMemory memory1; 111 SharedMemory memory1;
112 EXPECT_TRUE(memory1.CreateNamedDeprecated( 112 EXPECT_TRUE(memory1.CreateNamedDeprecated(
113 "SharedMemoryMultipleLockThreadTest", true, kDataSize)); 113 "SharedMemoryMultipleLockThreadTest", true, kDataSize));
114 EXPECT_TRUE(memory1.ShareToProcess(GetCurrentProcess(), &handle)); 114 EXPECT_TRUE(memory1.ShareToProcess(GetCurrentProcess(), &handle));
115 // TODO(paulg): Implement this once we have a posix version of 115 // TODO(paulg): Implement this once we have a posix version of
116 // SharedMemory::ShareToProcess. 116 // SharedMemory::ShareToProcess.
117 EXPECT_TRUE(true); 117 EXPECT_TRUE(true);
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 SharedMemoryProcessTest::CleanUp(); 714 SharedMemoryProcessTest::CleanUp();
715 } 715 }
716 716
717 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { 717 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) {
718 return SharedMemoryProcessTest::TaskTestMain(); 718 return SharedMemoryProcessTest::TaskTestMain();
719 } 719 }
720 720
721 #endif // !OS_IOS 721 #endif // !OS_IOS
722 722
723 } // namespace base 723 } // namespace base
OLDNEW
« no previous file with comments | « base/logging_win.h ('k') | base/message_loop/message_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698