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

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

Issue 427433003: Disable SharedMemoryTest.AnonymousExecutable on iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment about why test is ifdef'd out Created 6 years, 4 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 | no next file » | 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 EXPECT_TRUE(rv); 507 EXPECT_TRUE(rv);
508 508
509 void* old_address = memory.memory(); 509 void* old_address = memory.memory();
510 510
511 rv = memory.Map(kDataSize); 511 rv = memory.Map(kDataSize);
512 EXPECT_FALSE(rv); 512 EXPECT_FALSE(rv);
513 EXPECT_EQ(old_address, memory.memory()); 513 EXPECT_EQ(old_address, memory.memory());
514 } 514 }
515 515
516 #if defined(OS_POSIX) 516 #if defined(OS_POSIX)
517 // This test is not applicable for iOS (crbug.com/399384).
518 #if !defined(OS_IOS)
517 // Create a shared memory object, mmap it, and mprotect it to PROT_EXEC. 519 // Create a shared memory object, mmap it, and mprotect it to PROT_EXEC.
518 TEST(SharedMemoryTest, AnonymousExecutable) { 520 TEST(SharedMemoryTest, AnonymousExecutable) {
519 const uint32 kTestSize = 1 << 16; 521 const uint32 kTestSize = 1 << 16;
520 522
521 SharedMemory shared_memory; 523 SharedMemory shared_memory;
522 SharedMemoryCreateOptions options; 524 SharedMemoryCreateOptions options;
523 options.size = kTestSize; 525 options.size = kTestSize;
524 options.executable = true; 526 options.executable = true;
525 527
526 EXPECT_TRUE(shared_memory.Create(options)); 528 EXPECT_TRUE(shared_memory.Create(options));
527 EXPECT_TRUE(shared_memory.Map(shared_memory.requested_size())); 529 EXPECT_TRUE(shared_memory.Map(shared_memory.requested_size()));
528 530
529 EXPECT_EQ(0, mprotect(shared_memory.memory(), shared_memory.requested_size(), 531 EXPECT_EQ(0, mprotect(shared_memory.memory(), shared_memory.requested_size(),
530 PROT_READ | PROT_EXEC)); 532 PROT_READ | PROT_EXEC));
531 } 533 }
534 #endif // !defined(OS_IOS)
532 535
533 // Android supports a different permission model than POSIX for its "ashmem" 536 // Android supports a different permission model than POSIX for its "ashmem"
534 // shared memory implementation. So the tests about file permissions are not 537 // shared memory implementation. So the tests about file permissions are not
535 // included on Android. 538 // included on Android.
536 #if !defined(OS_ANDROID) 539 #if !defined(OS_ANDROID)
537 540
538 // Set a umask and restore the old mask on destruction. 541 // Set a umask and restore the old mask on destruction.
539 class ScopedUmaskSetter { 542 class ScopedUmaskSetter {
540 public: 543 public:
541 explicit ScopedUmaskSetter(mode_t target_mask) { 544 explicit ScopedUmaskSetter(mode_t target_mask) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 SharedMemoryProcessTest::CleanUp(); 680 SharedMemoryProcessTest::CleanUp();
678 } 681 }
679 682
680 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { 683 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) {
681 return SharedMemoryProcessTest::TaskTestMain(); 684 return SharedMemoryProcessTest::TaskTestMain();
682 } 685 }
683 686
684 #endif // !OS_IOS 687 #endif // !OS_IOS
685 688
686 } // namespace base 689 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698