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

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

Issue 2275553005: //base: Make ScopedTempDir::path() a GetPath() with a DCHECK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 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
« no previous file with comments | « base/debug/activity_tracker_unittest.cc ('k') | base/files/file_locking_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) 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 "base/files/dir_reader_posix.h" 5 #include "base/files/dir_reader_posix.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 11 matching lines...) Expand all
22 namespace base { 22 namespace base {
23 23
24 TEST(DirReaderPosixUnittest, Read) { 24 TEST(DirReaderPosixUnittest, Read) {
25 static const unsigned kNumFiles = 100; 25 static const unsigned kNumFiles = 100;
26 26
27 if (DirReaderPosix::IsFallback()) 27 if (DirReaderPosix::IsFallback())
28 return; 28 return;
29 29
30 base::ScopedTempDir temp_dir; 30 base::ScopedTempDir temp_dir;
31 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 31 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
32 const char* dir = temp_dir.path().value().c_str(); 32 const char* dir = temp_dir.GetPath().value().c_str();
33 ASSERT_TRUE(dir); 33 ASSERT_TRUE(dir);
34 34
35 const int prev_wd = open(".", O_RDONLY | O_DIRECTORY); 35 const int prev_wd = open(".", O_RDONLY | O_DIRECTORY);
36 DCHECK_GE(prev_wd, 0); 36 DCHECK_GE(prev_wd, 0);
37 37
38 PCHECK(chdir(dir) == 0); 38 PCHECK(chdir(dir) == 0);
39 39
40 for (unsigned i = 0; i < kNumFiles; i++) { 40 for (unsigned i = 0; i < kNumFiles; i++) {
41 char buf[16]; 41 char buf[16];
42 snprintf(buf, sizeof(buf), "%d", i); 42 snprintf(buf, sizeof(buf), "%d", i);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 PCHECK(fchdir(prev_wd) == 0); 87 PCHECK(fchdir(prev_wd) == 0);
88 PCHECK(close(prev_wd) == 0); 88 PCHECK(close(prev_wd) == 0);
89 89
90 EXPECT_TRUE(seen_dot); 90 EXPECT_TRUE(seen_dot);
91 EXPECT_TRUE(seen_dotdot); 91 EXPECT_TRUE(seen_dotdot);
92 EXPECT_EQ(kNumFiles, seen.size()); 92 EXPECT_EQ(kNumFiles, seen.size());
93 } 93 }
94 94
95 } // namespace base 95 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/activity_tracker_unittest.cc ('k') | base/files/file_locking_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698