| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/platform_file.h" | 6 #include "base/platform_file.h" |
| 7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Make sure the file was truncated. | 252 // Make sure the file was truncated. |
| 253 bytes_read = ReadFully(file, 0, data_read, kTestDataSize); | 253 bytes_read = ReadFully(file, 0, data_read, kTestDataSize); |
| 254 EXPECT_EQ(file_size, bytes_read); | 254 EXPECT_EQ(file_size, bytes_read); |
| 255 for (int i = 0; i < file_size; i++) | 255 for (int i = 0; i < file_size; i++) |
| 256 EXPECT_EQ(data_to_write[i], data_read[i]); | 256 EXPECT_EQ(data_to_write[i], data_read[i]); |
| 257 | 257 |
| 258 // Close the file handle to allow the temp directory to be deleted. | 258 // Close the file handle to allow the temp directory to be deleted. |
| 259 base::ClosePlatformFile(file); | 259 base::ClosePlatformFile(file); |
| 260 } | 260 } |
| 261 | 261 |
| 262 #if defined(OS_MACOSX) | |
| 263 // Flakily fails: http://crbug.com/86494 | 262 // Flakily fails: http://crbug.com/86494 |
| 264 #define MAYBE_TouchGetInfoPlatformFile FLAKY_TouchGetInfoPlatformFile | 263 TEST(PlatformFile, FLAKY_TouchGetInfoPlatformFile) { |
| 265 #else | |
| 266 #define MAYBE_TouchGetInfoPlatformFile TouchGetInfoPlatformFile | |
| 267 #endif | |
| 268 TEST(PlatformFile, MAYBE_TouchGetInfoPlatformFile) { | |
| 269 ScopedTempDir temp_dir; | 264 ScopedTempDir temp_dir; |
| 270 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 265 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 271 base::PlatformFile file = base::CreatePlatformFile( | 266 base::PlatformFile file = base::CreatePlatformFile( |
| 272 temp_dir.path().AppendASCII("touch_get_info_file"), | 267 temp_dir.path().AppendASCII("touch_get_info_file"), |
| 273 base::PLATFORM_FILE_CREATE | | 268 base::PLATFORM_FILE_CREATE | |
| 274 base::PLATFORM_FILE_WRITE | | 269 base::PLATFORM_FILE_WRITE | |
| 275 base::PLATFORM_FILE_WRITE_ATTRIBUTES, | 270 base::PLATFORM_FILE_WRITE_ATTRIBUTES, |
| 276 NULL, NULL); | 271 NULL, NULL); |
| 277 EXPECT_NE(base::kInvalidPlatformFileValue, file); | 272 EXPECT_NE(base::kInvalidPlatformFileValue, file); |
| 278 | 273 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 EXPECT_EQ(info.last_modified.ToInternalValue(), | 322 EXPECT_EQ(info.last_modified.ToInternalValue(), |
| 328 new_last_modified.ToInternalValue()); | 323 new_last_modified.ToInternalValue()); |
| 329 #endif | 324 #endif |
| 330 | 325 |
| 331 EXPECT_EQ(info.creation_time.ToInternalValue(), | 326 EXPECT_EQ(info.creation_time.ToInternalValue(), |
| 332 creation_time.ToInternalValue()); | 327 creation_time.ToInternalValue()); |
| 333 | 328 |
| 334 // Close the file handle to allow the temp directory to be deleted. | 329 // Close the file handle to allow the temp directory to be deleted. |
| 335 base::ClosePlatformFile(file); | 330 base::ClosePlatformFile(file); |
| 336 } | 331 } |
| OLD | NEW |