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 "ppapi/tests/test_file_mapping.h" | 5 #include "ppapi/tests/test_file_mapping.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 instance_->pp_instance(), | 491 instance_->pp_instance(), |
492 file_io2.pp_resource(), | 492 file_io2.pp_resource(), |
493 page_size, | 493 page_size, |
494 PP_FILEMAPPROTECTION_WRITE | PP_FILEMAPPROTECTION_READ, | 494 PP_FILEMAPPROTECTION_WRITE | PP_FILEMAPPROTECTION_READ, |
495 PP_FILEMAPFLAG_SHARED | PP_FILEMAPFLAG_FIXED, | 495 PP_FILEMAPFLAG_SHARED | PP_FILEMAPFLAG_FIXED, |
496 0, | 496 0, |
497 &address_of_middle_page, | 497 &address_of_middle_page, |
498 callback.GetCallback().pp_completion_callback())); | 498 callback.GetCallback().pp_completion_callback())); |
499 CHECK_CALLBACK_BEHAVIOR(callback); | 499 CHECK_CALLBACK_BEHAVIOR(callback); |
500 ASSERT_EQ(PP_OK, callback.result()); | 500 ASSERT_EQ(PP_OK, callback.result()); |
501 PASS(); | |
502 | 501 |
503 // Write something else to the mapped region, then unmap, and see if it | 502 // Write something else to the mapped region, then unmap, and see if it |
504 // gets written to both files. (Note we have to Unmap to make sure that the | 503 // gets written to both files. (Note we have to Unmap to make sure that the |
505 // write is committed). | 504 // write is committed). |
506 memset(address, 'c', kNumPages * page_size); | 505 memset(address, 'c', kNumPages * page_size); |
507 callback.WaitForResult( | 506 callback.WaitForResult( |
508 file_mapping_if_->Unmap( | 507 file_mapping_if_->Unmap( |
509 instance_->pp_instance(), address, kNumPages * page_size, | 508 instance_->pp_instance(), address, kNumPages * page_size, |
510 callback.GetCallback().pp_completion_callback())); | 509 callback.GetCallback().pp_completion_callback())); |
511 CHECK_CALLBACK_BEHAVIOR(callback); | 510 CHECK_CALLBACK_BEHAVIOR(callback); |
(...skipping 19 matching lines...) Expand all Loading... |
531 0, | 530 0, |
532 &new_file_contents2, | 531 &new_file_contents2, |
533 callback_type())); | 532 callback_type())); |
534 ASSERT_EQ(expected_file_contents2, new_file_contents2); | 533 ASSERT_EQ(expected_file_contents2, new_file_contents2); |
535 | 534 |
536 // TODO(dmichael): Test non-zero offset | 535 // TODO(dmichael): Test non-zero offset |
537 | 536 |
538 PASS(); | 537 PASS(); |
539 } | 538 } |
540 | 539 |
OLD | NEW |