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

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

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implicitcast: numericstest 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 | « base/android/scoped_java_ref.h ('k') | base/macros.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 "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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 EXPECT_EQ(0, info.size); 510 EXPECT_EQ(0, info.size);
511 } 511 }
512 #endif // defined(OS_WIN) 512 #endif // defined(OS_WIN)
513 513
514 #if defined(OS_POSIX) && defined(GTEST_HAS_DEATH_TEST) 514 #if defined(OS_POSIX) && defined(GTEST_HAS_DEATH_TEST)
515 TEST(FileTest, MemoryCorruption) { 515 TEST(FileTest, MemoryCorruption) {
516 { 516 {
517 // Test that changing the checksum value is detected. 517 // Test that changing the checksum value is detected.
518 base::File file; 518 base::File file;
519 EXPECT_NE(file.file_.file_memory_checksum_, 519 EXPECT_NE(file.file_.file_memory_checksum_,
520 implicit_cast<unsigned int>(file.GetPlatformFile())); 520 static_cast<unsigned int>(file.GetPlatformFile()));
521 file.file_.file_memory_checksum_ = file.GetPlatformFile(); 521 file.file_.file_memory_checksum_ = file.GetPlatformFile();
522 EXPECT_DEATH(file.IsValid(), ""); 522 EXPECT_DEATH(file.IsValid(), "");
523 523
524 file.file_.UpdateChecksum(); // Do not crash on File::~File(). 524 file.file_.UpdateChecksum(); // Do not crash on File::~File().
525 } 525 }
526 526
527 { 527 {
528 // Test that changing the file descriptor value is detected. 528 // Test that changing the file descriptor value is detected.
529 base::File file; 529 base::File file;
530 file.file_.file_.reset(17); 530 file.file_.file_.reset(17);
(...skipping 40 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 | « base/android/scoped_java_ref.h ('k') | base/macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698