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

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

Issue 101143006: Convert base::file_util to use File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove base:: Created 6 years, 11 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 | « base/files/file_path_watcher_win.cc ('k') | base/files/file_util_proxy.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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/file.h" 6 #include "base/files/file.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 char buffer[kDataSize]; 368 char buffer[kDataSize];
369 int first_chunk_size = kDataSize / 2; 369 int first_chunk_size = kDataSize / 2;
370 EXPECT_EQ(first_chunk_size, file.ReadAtCurrentPos(buffer, first_chunk_size)); 370 EXPECT_EQ(first_chunk_size, file.ReadAtCurrentPos(buffer, first_chunk_size));
371 EXPECT_EQ(kDataSize - first_chunk_size, 371 EXPECT_EQ(kDataSize - first_chunk_size,
372 file.ReadAtCurrentPos(buffer + first_chunk_size, 372 file.ReadAtCurrentPos(buffer + first_chunk_size,
373 kDataSize - first_chunk_size)); 373 kDataSize - first_chunk_size));
374 EXPECT_EQ(std::string(buffer, buffer + kDataSize), 374 EXPECT_EQ(std::string(buffer, buffer + kDataSize),
375 std::string(kData)); 375 std::string(kData));
376 } 376 }
377
378 #if defined(OS_WIN)
379 TEST(File, GetInfoForDirectory) {
380 base::ScopedTempDir temp_dir;
381 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
382 FilePath empty_dir = temp_dir.path().Append(FILE_PATH_LITERAL("gpfi_test"));
383 ASSERT_TRUE(CreateDirectory(empty_dir));
384
385 base::File dir(
386 ::CreateFile(empty_dir.value().c_str(),
387 FILE_ALL_ACCESS,
388 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
389 NULL,
390 OPEN_EXISTING,
391 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory.
392 NULL));
393 ASSERT_TRUE(dir.IsValid());
394
395 base::File::Info info;
396 EXPECT_TRUE(dir.GetInfo(&info));
397 EXPECT_TRUE(info.is_directory);
398 EXPECT_FALSE(info.is_symbolic_link);
399 EXPECT_EQ(0, info.size);
400 }
401 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_win.cc ('k') | base/files/file_util_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698