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

Side by Side Diff: base/files/file_util_unittest.cc

Issue 1172753003: Move LowerCaseEqualsASCII to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util
Patch Set: Created 5 years, 6 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 | « no previous file | base/strings/string_util.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) 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 EXPECT_FALSE(file.IsValid()); 2491 EXPECT_FALSE(file.IsValid());
2492 } 2492 }
2493 #endif 2493 #endif
2494 2494
2495 TEST(ScopedFD, ScopedFDDoesClose) { 2495 TEST(ScopedFD, ScopedFDDoesClose) {
2496 int fds[2]; 2496 int fds[2];
2497 char c = 0; 2497 char c = 0;
2498 ASSERT_EQ(0, pipe(fds)); 2498 ASSERT_EQ(0, pipe(fds));
2499 const int write_end = fds[1]; 2499 const int write_end = fds[1];
2500 ScopedFD read_end_closer(fds[0]); 2500 ScopedFD read_end_closer(fds[0]);
2501 { ScopedFD write_end_closer(fds[1]); } 2501 {
2502 ScopedFD write_end_closer(fds[1]);
2503 }
2502 // This is the only thread. This file descriptor should no longer be valid. 2504 // This is the only thread. This file descriptor should no longer be valid.
2503 int ret = close(write_end); 2505 int ret = close(write_end);
2504 EXPECT_EQ(-1, ret); 2506 EXPECT_EQ(-1, ret);
2505 EXPECT_EQ(EBADF, errno); 2507 EXPECT_EQ(EBADF, errno);
2506 // Make sure read(2) won't block. 2508 // Make sure read(2) won't block.
2507 ASSERT_EQ(0, fcntl(fds[0], F_SETFL, O_NONBLOCK)); 2509 ASSERT_EQ(0, fcntl(fds[0], F_SETFL, O_NONBLOCK));
2508 // Reading the pipe should EOF. 2510 // Reading the pipe should EOF.
2509 EXPECT_EQ(0, read(fds[0], &c, 1)); 2511 EXPECT_EQ(0, read(fds[0], &c, 1));
2510 } 2512 }
2511 2513
(...skipping 13 matching lines...) Expand all
2525 // Trying to close it should crash. This is important for security. 2527 // Trying to close it should crash. This is important for security.
2526 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); 2528 EXPECT_DEATH(CloseWithScopedFD(fds[1]), "");
2527 #endif 2529 #endif
2528 } 2530 }
2529 2531
2530 #endif // defined(OS_POSIX) 2532 #endif // defined(OS_POSIX)
2531 2533
2532 } // namespace 2534 } // namespace
2533 2535
2534 } // namespace base 2536 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/strings/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698