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

Side by Side Diff: ipc/file_descriptor_set_posix_unittest.cc

Issue 7817005: Convert some constants declared as anonymous enums into static consts so they have types. This d... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « ipc/file_descriptor_set_posix.cc ('k') | ipc/ipc_channel.h » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/file_descriptor_set_posix.h" 7 #include "ipc/file_descriptor_set_posix.h"
8 8
9 #include <unistd.h> 9 #include <unistd.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ASSERT_EQ(set->size(), 1u); 60 ASSERT_EQ(set->size(), 1u);
61 ASSERT_TRUE(!set->empty()); 61 ASSERT_TRUE(!set->empty());
62 62
63 set->CommitAll(); 63 set->CommitAll();
64 64
65 ASSERT_TRUE(VerifyClosed(fd)); 65 ASSERT_TRUE(VerifyClosed(fd));
66 } 66 }
67 TEST(FileDescriptorSet, MaxSize) { 67 TEST(FileDescriptorSet, MaxSize) {
68 scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); 68 scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet);
69 69
70 for (unsigned i = 0; 70 for (size_t i = 0; i < FileDescriptorSet::kMaxDescriptorsPerMessage; ++i)
71 i < FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; ++i) {
72 ASSERT_TRUE(set->Add(kFDBase + 1 + i)); 71 ASSERT_TRUE(set->Add(kFDBase + 1 + i));
73 }
74 72
75 ASSERT_TRUE(!set->Add(kFDBase)); 73 ASSERT_TRUE(!set->Add(kFDBase));
76 74
77 set->CommitAll(); 75 set->CommitAll();
78 } 76 }
79 77
80 TEST(FileDescriptorSet, SetDescriptors) { 78 TEST(FileDescriptorSet, SetDescriptors) {
81 scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); 79 scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet);
82 80
83 ASSERT_TRUE(set->empty()); 81 ASSERT_TRUE(set->empty());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); 168 scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet);
171 169
172 const int fd = GetSafeFd(); 170 const int fd = GetSafeFd();
173 ASSERT_TRUE(set->AddAndAutoClose(fd)); 171 ASSERT_TRUE(set->AddAndAutoClose(fd));
174 set->CommitAll(); 172 set->CommitAll();
175 173
176 ASSERT_TRUE(VerifyClosed(fd)); 174 ASSERT_TRUE(VerifyClosed(fd));
177 } 175 }
178 176
179 } // namespace 177 } // namespace
OLDNEW
« no previous file with comments | « ipc/file_descriptor_set_posix.cc ('k') | ipc/ipc_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698