summaryrefslogtreecommitdiffstats
path: root/ipc/file_descriptor_set_posix_unittest.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 00:50:13 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 00:50:13 +0000
commit05094a3fd1209ad3c5fa5c92c78694da589b9448 (patch)
tree59eab02505b51bcff2c1a48ea097de85befbfaef /ipc/file_descriptor_set_posix_unittest.cc
parentd643172a8573e7e75f325bec2125de8071bfd0fc (diff)
downloadchromium_src-05094a3fd1209ad3c5fa5c92c78694da589b9448.zip
chromium_src-05094a3fd1209ad3c5fa5c92c78694da589b9448.tar.gz
chromium_src-05094a3fd1209ad3c5fa5c92c78694da589b9448.tar.bz2
Convert some constants declared as anonymous enums into static consts so they have types. This defines the constants where they're declared to preserve the existing readability as well as allow us to do things like dimension arrays based on the values of the constants.
The drawback to defining constants at their declaration point is that supplying them to a templated function, like what DCHECK_EQ() expands into, triggers an "undefined symbol" error on Mac/Linux (and adding explicit storage for them in the .cc file can cause duplicate symbol errors on Windows). Here I've worked around that by converting DCHECK_EQ(a, b) to DCHECK(b == a). The original motiviation for this change was to find a way to eliminate some cases of passing anonymous-typed values as template arguments (which happens when you use a value from the enum in e.g. EXPECT_EQ()), which is technically illegal in C++03, though we don't warn about it. Simply naming the enum would have done this, but in general naming enums used to declare constants like this is bizarre ("enum Constants { ... }"?). BUG=92247 TEST=Compiles Review URL: http://codereview.chromium.org/7817005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/file_descriptor_set_posix_unittest.cc')
-rw-r--r--ipc/file_descriptor_set_posix_unittest.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/ipc/file_descriptor_set_posix_unittest.cc b/ipc/file_descriptor_set_posix_unittest.cc
index 5fc8c50..fdb00f51 100644
--- a/ipc/file_descriptor_set_posix_unittest.cc
+++ b/ipc/file_descriptor_set_posix_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -67,10 +67,8 @@ TEST(FileDescriptorSet, BasicAddAndClose) {
TEST(FileDescriptorSet, MaxSize) {
scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet);
- for (unsigned i = 0;
- i < FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; ++i) {
+ for (size_t i = 0; i < FileDescriptorSet::kMaxDescriptorsPerMessage; ++i)
ASSERT_TRUE(set->Add(kFDBase + 1 + i));
- }
ASSERT_TRUE(!set->Add(kFDBase));