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 "ppapi/tests/test_file_ref.h" | 5 #include "ppapi/tests/test_file_ref.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <sstream> | 9 #include <sstream> |
10 #include <vector> | 10 #include <vector> |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 callback.GetCallback())); | 358 callback.GetCallback())); |
359 CHECK_CALLBACK_BEHAVIOR(callback); | 359 CHECK_CALLBACK_BEHAVIOR(callback); |
360 ASSERT_EQ(PP_OK, callback.result()); | 360 ASSERT_EQ(PP_OK, callback.result()); |
361 | 361 |
362 // Write some data to have a non-zero file size. | 362 // Write some data to have a non-zero file size. |
363 callback.WaitForResult(file_io.Write(0, "test", 4, callback.GetCallback())); | 363 callback.WaitForResult(file_io.Write(0, "test", 4, callback.GetCallback())); |
364 CHECK_CALLBACK_BEHAVIOR(callback); | 364 CHECK_CALLBACK_BEHAVIOR(callback); |
365 ASSERT_EQ(4, callback.result()); | 365 ASSERT_EQ(4, callback.result()); |
366 | 366 |
367 // Touch. | 367 // Touch. |
368 // last_access_time's granularity is 1 day | 368 const PP_Time last_access_time = 123 * 24 * 3600.0; |
369 // last_modified_time's granularity is 2 seconds | 369 // last_modified_time's granularity is 2 seconds |
370 const PP_Time last_access_time = 123 * 24 * 3600.0; | 370 // See note in test_file_io.cc for why we use this time. |
371 const PP_Time last_modified_time = 246.0; | 371 const PP_Time last_modified_time = 100 * 24 * 3600.0; |
372 callback.WaitForResult(file_ref.Touch(last_access_time, last_modified_time, | 372 callback.WaitForResult(file_ref.Touch(last_access_time, last_modified_time, |
373 callback.GetCallback())); | 373 callback.GetCallback())); |
374 CHECK_CALLBACK_BEHAVIOR(callback); | 374 CHECK_CALLBACK_BEHAVIOR(callback); |
375 ASSERT_EQ(PP_OK, callback.result()); | 375 ASSERT_EQ(PP_OK, callback.result()); |
376 | 376 |
377 // Touch aborted. | 377 // Touch aborted. |
378 int32_t rv = PP_ERROR_FAILED; | 378 int32_t rv = PP_ERROR_FAILED; |
379 { | 379 { |
380 rv = pp::FileRef(file_system, "/file_touch_abort") | 380 rv = pp::FileRef(file_system, "/file_touch_abort") |
381 .Touch(last_access_time, last_modified_time, callback.GetCallback()); | 381 .Touch(last_access_time, last_modified_time, callback.GetCallback()); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 { | 743 { |
744 rv = pp::FileRef(file_system, test_dir_name) | 744 rv = pp::FileRef(file_system, test_dir_name) |
745 .ReadDirectoryEntries(output_callback.GetCallback()); | 745 .ReadDirectoryEntries(output_callback.GetCallback()); |
746 } | 746 } |
747 output_callback.WaitForAbortResult(rv); | 747 output_callback.WaitForAbortResult(rv); |
748 CHECK_CALLBACK_BEHAVIOR(output_callback); | 748 CHECK_CALLBACK_BEHAVIOR(output_callback); |
749 | 749 |
750 | 750 |
751 PASS(); | 751 PASS(); |
752 } | 752 } |
OLD | NEW |