OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_proxy.h" | 5 #include "base/files/file_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 EXPECT_EQ(File::FILE_OK, error_); | 280 EXPECT_EQ(File::FILE_OK, error_); |
281 | 281 |
282 // Verify the written data. | 282 // Verify the written data. |
283 char buffer[10]; | 283 char buffer[10]; |
284 EXPECT_EQ(data_bytes, base::ReadFile(test_path(), buffer, data_bytes)); | 284 EXPECT_EQ(data_bytes, base::ReadFile(test_path(), buffer, data_bytes)); |
285 for (int i = 0; i < data_bytes; ++i) { | 285 for (int i = 0; i < data_bytes; ++i) { |
286 EXPECT_EQ(data[i], buffer[i]); | 286 EXPECT_EQ(data[i], buffer[i]); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 TEST_F(FileProxyTest, SetTimes) { | 290 #if defined(OS_ANDROID) |
| 291 // Flaky on Android, see http://crbug.com/489602 |
| 292 #define MAYBE_SetTimes DISABLED_SetTimes |
| 293 #else |
| 294 #define MAYBE_SetTimes SetTimes |
| 295 #endif |
| 296 TEST_F(FileProxyTest, MAYBE_SetTimes) { |
291 FileProxy proxy(file_task_runner()); | 297 FileProxy proxy(file_task_runner()); |
292 CreateProxy( | 298 CreateProxy( |
293 File::FLAG_CREATE | File::FLAG_WRITE | File::FLAG_WRITE_ATTRIBUTES, | 299 File::FLAG_CREATE | File::FLAG_WRITE | File::FLAG_WRITE_ATTRIBUTES, |
294 &proxy); | 300 &proxy); |
295 | 301 |
296 Time last_accessed_time = Time::Now() - TimeDelta::FromDays(12345); | 302 Time last_accessed_time = Time::Now() - TimeDelta::FromDays(12345); |
297 Time last_modified_time = Time::Now() - TimeDelta::FromHours(98765); | 303 Time last_modified_time = Time::Now() - TimeDelta::FromHours(98765); |
298 | 304 |
299 proxy.SetTimes(last_accessed_time, last_modified_time, | 305 proxy.SetTimes(last_accessed_time, last_modified_time, |
300 Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr())); | 306 Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr())); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 char buffer[53]; | 366 char buffer[53]; |
361 EXPECT_EQ(53, base::ReadFile(test_path(), buffer, 53)); | 367 EXPECT_EQ(53, base::ReadFile(test_path(), buffer, 53)); |
362 int i = 0; | 368 int i = 0; |
363 for (; i < 10; ++i) | 369 for (; i < 10; ++i) |
364 EXPECT_EQ(kTestData[i], buffer[i]); | 370 EXPECT_EQ(kTestData[i], buffer[i]); |
365 for (; i < 53; ++i) | 371 for (; i < 53; ++i) |
366 EXPECT_EQ(0, buffer[i]); | 372 EXPECT_EQ(0, buffer[i]); |
367 } | 373 } |
368 | 374 |
369 } // namespace base | 375 } // namespace base |
OLD | NEW |