OLD | NEW |
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 "ppapi/tests/test_post_message.h" | 5 #include "ppapi/tests/test_post_message.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 PP_Var var = message_data_.back().Detach(); | 613 PP_Var var = message_data_.back().Detach(); |
614 PP_Resource result = var_resource_interface_->VarToResource(var); | 614 PP_Resource result = var_resource_interface_->VarToResource(var); |
615 ASSERT_TRUE(file_system_interface_->IsFileSystem(result)); | 615 ASSERT_TRUE(file_system_interface_->IsFileSystem(result)); |
616 { | 616 { |
617 pp::FileSystem file_system(pp::PASS_REF, result); | 617 pp::FileSystem file_system(pp::PASS_REF, result); |
618 std::string file_path("/"); | 618 std::string file_path("/"); |
619 file_path += kTestFilename; | 619 file_path += kTestFilename; |
620 pp::FileRef file_ref(file_system, file_path.c_str()); | 620 pp::FileRef file_ref(file_system, file_path.c_str()); |
621 ASSERT_NE(0, file_ref.pp_resource()); | 621 ASSERT_NE(0, file_ref.pp_resource()); |
622 | 622 |
| 623 // Ensure that the file can be queried. |
| 624 TestCompletionCallbackWithOutput<PP_FileInfo> cc(instance_->pp_instance(), |
| 625 callback_type()); |
| 626 cc.WaitForResult(file_ref.Query(cc.GetCallback())); |
| 627 CHECK_CALLBACK_BEHAVIOR(cc); |
| 628 ASSERT_EQ(PP_OK, cc.result()); |
| 629 |
623 // Read the file and test that its contents match. | 630 // Read the file and test that its contents match. |
624 pp::FileIO file_io(instance_); | 631 pp::FileIO file_io(instance_); |
625 ASSERT_NE(0, file_io.pp_resource()); | 632 ASSERT_NE(0, file_io.pp_resource()); |
626 TestCompletionCallback callback(instance_->pp_instance(), | 633 TestCompletionCallback callback(instance_->pp_instance(), |
627 callback_type()); | 634 callback_type()); |
628 callback.WaitForResult( | 635 callback.WaitForResult( |
629 file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback())); | 636 file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback.GetCallback())); |
630 CHECK_CALLBACK_BEHAVIOR(callback); | 637 CHECK_CALLBACK_BEHAVIOR(callback); |
631 ASSERT_EQ(PP_OK, callback.result()); | 638 ASSERT_EQ(PP_OK, callback.result()); |
632 | 639 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 ASSERT_TRUE(received_value <= kThreadsToRun); | 881 ASSERT_TRUE(received_value <= kThreadsToRun); |
875 ++received_counts[received_value]; | 882 ++received_counts[received_value]; |
876 } | 883 } |
877 ASSERT_EQ(received_counts, expected_counts); | 884 ASSERT_EQ(received_counts, expected_counts); |
878 | 885 |
879 message_data_.clear(); | 886 message_data_.clear(); |
880 ASSERT_TRUE(ClearListeners()); | 887 ASSERT_TRUE(ClearListeners()); |
881 | 888 |
882 PASS(); | 889 PASS(); |
883 } | 890 } |
OLD | NEW |