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

Side by Side Diff: base/shared_memory_unittest.cc

Issue 10701121: Exclude unsupported tests from the android build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/sys_info_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 #if defined(OS_MACOSX) 6 #if defined(OS_MACOSX)
7 #include "base/mac/scoped_nsautorelease_pool.h" 7 #include "base/mac/scoped_nsautorelease_pool.h"
8 #endif 8 #endif
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 private: 124 private:
125 int id_; 125 int id_;
126 126
127 DISALLOW_COPY_AND_ASSIGN(MultipleLockThread); 127 DISALLOW_COPY_AND_ASSIGN(MultipleLockThread);
128 }; 128 };
129 #endif 129 #endif
130 130
131 } // namespace 131 } // namespace
132 132
133 // Android doesn't support SharedMemory::Open/Delete/
134 // CreateNamed(openExisting=true)
135 #if !defined(OS_ANDROID)
133 TEST(SharedMemoryTest, OpenClose) { 136 TEST(SharedMemoryTest, OpenClose) {
134 const uint32 kDataSize = 1024; 137 const uint32 kDataSize = 1024;
135 std::string test_name = "SharedMemoryOpenCloseTest"; 138 std::string test_name = "SharedMemoryOpenCloseTest";
136 139
137 // Open two handles to a memory segment, confirm that they are mapped 140 // Open two handles to a memory segment, confirm that they are mapped
138 // separately yet point to the same space. 141 // separately yet point to the same space.
139 SharedMemory memory1; 142 SharedMemory memory1;
140 bool rv = memory1.Delete(test_name); 143 bool rv = memory1.Delete(test_name);
141 EXPECT_TRUE(rv); 144 EXPECT_TRUE(rv);
142 rv = memory1.Delete(test_name); 145 rv = memory1.Delete(test_name);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 for (char* ptr = start_ptr; ptr < end_ptr; ptr++) { 225 for (char* ptr = start_ptr; ptr < end_ptr; ptr++) {
223 EXPECT_EQ(*ptr, 'G'); 226 EXPECT_EQ(*ptr, 'G');
224 } 227 }
225 228
226 memory1.Close(); 229 memory1.Close();
227 memory2.Close(); 230 memory2.Close();
228 231
229 rv = memory1.Delete(test_name); 232 rv = memory1.Delete(test_name);
230 EXPECT_TRUE(rv); 233 EXPECT_TRUE(rv);
231 } 234 }
235 #endif
232 236
233 // Create a set of N threads to each open a shared memory segment and write to 237 // Create a set of N threads to each open a shared memory segment and write to
234 // it. Verify that they are always reading/writing consistent data. 238 // it. Verify that they are always reading/writing consistent data.
235 TEST(SharedMemoryTest, MultipleThreads) { 239 TEST(SharedMemoryTest, MultipleThreads) {
236 MultipleThreadMain::CleanUp(); 240 MultipleThreadMain::CleanUp();
237 // On POSIX we have a problem when 2 threads try to create the shmem 241 // On POSIX we have a problem when 2 threads try to create the shmem
238 // (a file) at exactly the same time, since create both creates the 242 // (a file) at exactly the same time, since create both creates the
239 // file and zerofills it. We solve the problem for this unit test 243 // file and zerofills it. We solve the problem for this unit test
240 // (make it not flaky) by starting with 1 thread, then 244 // (make it not flaky) by starting with 1 thread, then
241 // intentionally don't clean up its shmem before running with 245 // intentionally don't clean up its shmem before running with
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 431 }
428 432
429 SharedMemoryProcessTest::CleanUp(); 433 SharedMemoryProcessTest::CleanUp();
430 } 434 }
431 435
432 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { 436 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) {
433 return SharedMemoryProcessTest::TaskTestMain(); 437 return SharedMemoryProcessTest::TaskTestMain();
434 } 438 }
435 439
436 } // namespace base 440 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/sys_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698