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

Side by Side Diff: ipc/ipc_message_attachment_set_posix_unittest.cc

Issue 1259823002: Remove Android filter file for ipc_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remaining tests Created 5 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
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This test is POSIX only. 5 // This test is POSIX only.
6 6
7 #include "ipc/ipc_message_attachment_set.h" 7 #include "ipc/ipc_message_attachment_set.h"
8 8
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 for (size_t i = 0; i < MessageAttachmentSet::kMaxDescriptorsPerMessage; ++i) 74 for (size_t i = 0; i < MessageAttachmentSet::kMaxDescriptorsPerMessage; ++i)
75 ASSERT_TRUE(set->AddAttachment( 75 ASSERT_TRUE(set->AddAttachment(
76 new internal::PlatformFileAttachment(kFDBase + 1 + i))); 76 new internal::PlatformFileAttachment(kFDBase + 1 + i)));
77 77
78 ASSERT_TRUE( 78 ASSERT_TRUE(
79 !set->AddAttachment(new internal::PlatformFileAttachment(kFDBase))); 79 !set->AddAttachment(new internal::PlatformFileAttachment(kFDBase)));
80 80
81 set->CommitAll(); 81 set->CommitAll();
82 } 82 }
83 83
84 TEST(MessageAttachmentSet, SetDescriptors) { 84 #if defined(OS_ANDROID)
85 #define MAYBE_SetDescriptors DISABLED_SetDescriptors
86 #else
87 #define MAYBE_SetDescriptors SetDescriptors
88 #endif
89 TEST(MessageAttachmentSet, MAYBE_SetDescriptors) {
85 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet); 90 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet);
86 91
87 ASSERT_TRUE(set->empty()); 92 ASSERT_TRUE(set->empty());
88 set->AddDescriptorsToOwn(NULL, 0); 93 set->AddDescriptorsToOwn(NULL, 0);
89 ASSERT_TRUE(set->empty()); 94 ASSERT_TRUE(set->empty());
90 95
91 const int fd = GetSafeFd(); 96 const int fd = GetSafeFd();
92 static const int fds[] = {fd}; 97 static const int fds[] = {fd};
93 set->AddDescriptorsToOwn(fds, 1); 98 set->AddDescriptorsToOwn(fds, 1);
94 ASSERT_TRUE(!set->empty()); 99 ASSERT_TRUE(!set->empty());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ASSERT_EQ(set->GetAttachmentAt(0)->TakePlatformFile(), kFDBase); 174 ASSERT_EQ(set->GetAttachmentAt(0)->TakePlatformFile(), kFDBase);
170 ASSERT_EQ(set->GetAttachmentAt(1)->TakePlatformFile(), kFDBase + 1); 175 ASSERT_EQ(set->GetAttachmentAt(1)->TakePlatformFile(), kFDBase + 1);
171 ASSERT_EQ(set->GetAttachmentAt(2)->TakePlatformFile(), kFDBase + 2); 176 ASSERT_EQ(set->GetAttachmentAt(2)->TakePlatformFile(), kFDBase + 2);
172 ASSERT_EQ(set->GetAttachmentAt(0)->TakePlatformFile(), kFDBase); 177 ASSERT_EQ(set->GetAttachmentAt(0)->TakePlatformFile(), kFDBase);
173 ASSERT_EQ(set->GetAttachmentAt(1)->TakePlatformFile(), kFDBase + 1); 178 ASSERT_EQ(set->GetAttachmentAt(1)->TakePlatformFile(), kFDBase + 1);
174 ASSERT_EQ(set->GetAttachmentAt(2)->TakePlatformFile(), kFDBase + 2); 179 ASSERT_EQ(set->GetAttachmentAt(2)->TakePlatformFile(), kFDBase + 2);
175 180
176 set->CommitAll(); 181 set->CommitAll();
177 } 182 }
178 183
179 TEST(MessageAttachmentSet, DontClose) { 184 #if defined(OS_ANDROID)
185 #define MAYBE_DontClose DISABLED_DontClose
186 #else
187 #define MAYBE_DontClose DontClose
188 #endif
189 TEST(MessageAttachmentSet, MAYBE_DontClose) {
180 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet); 190 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet);
181 191
182 const int fd = GetSafeFd(); 192 const int fd = GetSafeFd();
183 ASSERT_TRUE(set->AddAttachment(new internal::PlatformFileAttachment(fd))); 193 ASSERT_TRUE(set->AddAttachment(new internal::PlatformFileAttachment(fd)));
184 set->CommitAll(); 194 set->CommitAll();
185 195
186 ASSERT_FALSE(VerifyClosed(fd)); 196 ASSERT_FALSE(VerifyClosed(fd));
187 } 197 }
188 198
189 TEST(MessageAttachmentSet, DoClose) { 199 TEST(MessageAttachmentSet, DoClose) {
190 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet); 200 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet);
191 201
192 const int fd = GetSafeFd(); 202 const int fd = GetSafeFd();
193 ASSERT_TRUE(set->AddAttachment( 203 ASSERT_TRUE(set->AddAttachment(
194 new internal::PlatformFileAttachment(base::ScopedFD(fd)))); 204 new internal::PlatformFileAttachment(base::ScopedFD(fd))));
195 set->CommitAll(); 205 set->CommitAll();
196 206
197 ASSERT_TRUE(VerifyClosed(fd)); 207 ASSERT_TRUE(VerifyClosed(fd));
198 } 208 }
199 209
200 } // namespace 210 } // namespace
201 } // namespace IPC 211 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_fuzzing_tests.cc ('k') | ipc/ipc_message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698