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

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

Issue 1348533003: Fix three Windows base_unittests to not require admin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | base/files/file_util_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/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 #if defined(OS_WIN) 489 #if defined(OS_WIN)
490 TEST(FileTest, GetInfoForDirectory) { 490 TEST(FileTest, GetInfoForDirectory) {
491 base::ScopedTempDir temp_dir; 491 base::ScopedTempDir temp_dir;
492 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 492 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
493 FilePath empty_dir = temp_dir.path().Append(FILE_PATH_LITERAL("gpfi_test")); 493 FilePath empty_dir = temp_dir.path().Append(FILE_PATH_LITERAL("gpfi_test"));
494 ASSERT_TRUE(CreateDirectory(empty_dir)); 494 ASSERT_TRUE(CreateDirectory(empty_dir));
495 495
496 base::File dir( 496 base::File dir(
497 ::CreateFile(empty_dir.value().c_str(), 497 ::CreateFile(empty_dir.value().c_str(),
498 FILE_ALL_ACCESS, 498 GENERIC_READ | GENERIC_WRITE,
499 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 499 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
500 NULL, 500 NULL,
501 OPEN_EXISTING, 501 OPEN_EXISTING,
502 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory. 502 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory.
503 NULL)); 503 NULL));
504 ASSERT_TRUE(dir.IsValid()); 504 ASSERT_TRUE(dir.IsValid());
505 505
506 base::File::Info info; 506 base::File::Info info;
507 EXPECT_TRUE(dir.GetInfo(&info)); 507 EXPECT_TRUE(dir.GetInfo(&info));
508 EXPECT_TRUE(info.is_directory); 508 EXPECT_TRUE(info.is_directory);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 EXPECT_DEATH(file.Seek(File::FROM_BEGIN, 0), ""); 571 EXPECT_DEATH(file.Seek(File::FROM_BEGIN, 0), "");
572 EXPECT_DEATH(file.Read(0, NULL, 0), ""); 572 EXPECT_DEATH(file.Read(0, NULL, 0), "");
573 EXPECT_DEATH(file.ReadAtCurrentPos(NULL, 0), ""); 573 EXPECT_DEATH(file.ReadAtCurrentPos(NULL, 0), "");
574 EXPECT_DEATH(file.Write(0, NULL, 0), ""); 574 EXPECT_DEATH(file.Write(0, NULL, 0), "");
575 575
576 ignore_result(file.file_.file_.release()); 576 ignore_result(file.file_.file_.release());
577 file.file_.UpdateChecksum(); 577 file.file_.UpdateChecksum();
578 } 578 }
579 } 579 }
580 #endif // defined(OS_POSIX) 580 #endif // defined(OS_POSIX)
OLDNEW
« no previous file with comments | « no previous file | base/files/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698