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

Side by Side Diff: ipc/ipc_message_attachment_set_posix_unittest.cc

Issue 1958823002: Fix implicit access to raw pointer of scoped_refptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Splitting out change to scoped_refptr to follow up patch. Created 4 years, 7 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 | « ios/web/web_state/ui/crw_web_controller.mm ('k') | media/blink/video_frame_compositor.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 <stddef.h> 10 #include <stddef.h>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // TODO(morrita): This test is wrong. TakeDescriptorAt() shouldn't be 147 // TODO(morrita): This test is wrong. TakeDescriptorAt() shouldn't be
148 // used to retrieve borrowed descriptors. That never happens in production. 148 // used to retrieve borrowed descriptors. That never happens in production.
149 ASSERT_TRUE( 149 ASSERT_TRUE(
150 set->AddAttachment(new internal::PlatformFileAttachment(kFDBase))); 150 set->AddAttachment(new internal::PlatformFileAttachment(kFDBase)));
151 ASSERT_TRUE( 151 ASSERT_TRUE(
152 set->AddAttachment(new internal::PlatformFileAttachment(kFDBase + 1))); 152 set->AddAttachment(new internal::PlatformFileAttachment(kFDBase + 1)));
153 ASSERT_TRUE( 153 ASSERT_TRUE(
154 set->AddAttachment(new internal::PlatformFileAttachment(kFDBase + 2))); 154 set->AddAttachment(new internal::PlatformFileAttachment(kFDBase + 2)));
155 155
156 ASSERT_EQ(set->GetNonBrokerableAttachmentAt(0)->TakePlatformFile(), kFDBase); 156 ASSERT_EQ(set->GetNonBrokerableAttachmentAt(0)->TakePlatformFile(), kFDBase);
157 ASSERT_EQ(set->GetNonBrokerableAttachmentAt(2), nullptr); 157 ASSERT_FALSE(set->GetNonBrokerableAttachmentAt(2));
158 158
159 set->CommitAllDescriptors(); 159 set->CommitAllDescriptors();
160 } 160 }
161 161
162 TEST(MessageAttachmentSet, WalkCycle) { 162 TEST(MessageAttachmentSet, WalkCycle) {
163 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet); 163 scoped_refptr<MessageAttachmentSet> set(new MessageAttachmentSet);
164 164
165 // TODO(morrita): This test is wrong. TakeDescriptorAt() shouldn't be 165 // TODO(morrita): This test is wrong. TakeDescriptorAt() shouldn't be
166 // used to retrieve borrowed descriptors. That never happens in production. 166 // used to retrieve borrowed descriptors. That never happens in production.
167 ASSERT_TRUE( 167 ASSERT_TRUE(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 const int fd = GetSafeFd(); 211 const int fd = GetSafeFd();
212 ASSERT_TRUE(set->AddAttachment( 212 ASSERT_TRUE(set->AddAttachment(
213 new internal::PlatformFileAttachment(base::ScopedFD(fd)))); 213 new internal::PlatformFileAttachment(base::ScopedFD(fd))));
214 set->CommitAllDescriptors(); 214 set->CommitAllDescriptors();
215 215
216 ASSERT_TRUE(VerifyClosed(fd)); 216 ASSERT_TRUE(VerifyClosed(fd));
217 } 217 }
218 218
219 } // namespace 219 } // namespace
220 } // namespace IPC 220 } // namespace IPC
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | media/blink/video_frame_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698