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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
11 #include "ppapi/c/ppb_file_io.h" | 11 #include "ppapi/c/ppb_file_io.h" |
12 #include "ppapi/c/dev/ppb_testing_dev.h" | 12 #include "ppapi/c/dev/ppb_testing_dev.h" |
13 #include "ppapi/cpp/dev/directory_entry_dev.h" | 13 #include "ppapi/cpp/directory_entry.h" |
14 #include "ppapi/cpp/dev/directory_reader_dev.h" | 14 #include "ppapi/cpp/directory_reader.h" |
15 #include "ppapi/cpp/file_io.h" | 15 #include "ppapi/cpp/file_io.h" |
16 #include "ppapi/cpp/file_ref.h" | 16 #include "ppapi/cpp/file_ref.h" |
17 #include "ppapi/cpp/file_system.h" | 17 #include "ppapi/cpp/file_system.h" |
18 #include "ppapi/cpp/instance.h" | 18 #include "ppapi/cpp/instance.h" |
19 #include "ppapi/cpp/module.h" | 19 #include "ppapi/cpp/module.h" |
20 #include "ppapi/cpp/url_loader.h" | 20 #include "ppapi/cpp/url_loader.h" |
21 #include "ppapi/cpp/url_request_info.h" | 21 #include "ppapi/cpp/url_request_info.h" |
22 #include "ppapi/cpp/url_response_info.h" | 22 #include "ppapi/cpp/url_response_info.h" |
23 #include "ppapi/tests/test_utils.h" | 23 #include "ppapi/tests/test_utils.h" |
24 #include "ppapi/tests/testing_instance.h" | 24 #include "ppapi/tests/testing_instance.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 std::string full_file_path = test_dir_path + "/" + kTerribleName; | 583 std::string full_file_path = test_dir_path + "/" + kTerribleName; |
584 pp::FileRef file_ref(file_system, full_file_path.c_str()); | 584 pp::FileRef file_ref(file_system, full_file_path.c_str()); |
585 pp::FileIO file_io(instance_); | 585 pp::FileIO file_io(instance_); |
586 callback.WaitForResult( | 586 callback.WaitForResult( |
587 file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback())); | 587 file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback.GetCallback())); |
588 CHECK_CALLBACK_BEHAVIOR(callback); | 588 CHECK_CALLBACK_BEHAVIOR(callback); |
589 ASSERT_EQ(PP_OK, callback.result()); | 589 ASSERT_EQ(PP_OK, callback.result()); |
590 | 590 |
591 // DirectoryReader only works out-of-process. | 591 // DirectoryReader only works out-of-process. |
592 if (testing_interface_->IsOutOfProcess()) { | 592 if (testing_interface_->IsOutOfProcess()) { |
593 TestCompletionCallbackWithOutput< std::vector<pp::DirectoryEntry_Dev> > | 593 TestCompletionCallbackWithOutput< std::vector<pp::DirectoryEntry> > |
594 output_callback(instance_->pp_instance(), callback_type()); | 594 output_callback(instance_->pp_instance(), callback_type()); |
595 pp::DirectoryReader_Dev directory_reader(test_dir_ref); | 595 pp::DirectoryReader directory_reader(test_dir_ref); |
596 | 596 |
597 output_callback.WaitForResult( | 597 output_callback.WaitForResult( |
598 directory_reader.ReadEntries(output_callback.GetCallback())); | 598 directory_reader.ReadEntries(output_callback.GetCallback())); |
599 CHECK_CALLBACK_BEHAVIOR(output_callback); | 599 CHECK_CALLBACK_BEHAVIOR(output_callback); |
600 ASSERT_EQ(PP_OK, output_callback.result()); | 600 ASSERT_EQ(PP_OK, output_callback.result()); |
601 | 601 |
602 std::vector<pp::DirectoryEntry_Dev> entries = output_callback.output(); | 602 std::vector<pp::DirectoryEntry> entries = output_callback.output(); |
603 ASSERT_EQ(1, entries.size()); | 603 ASSERT_EQ(1, entries.size()); |
604 ASSERT_EQ(kTerribleName, entries.front().file_ref().GetName().AsString()); | 604 ASSERT_EQ(kTerribleName, entries.front().file_ref().GetName().AsString()); |
605 } | 605 } |
606 | 606 |
607 PASS(); | 607 PASS(); |
608 } | 608 } |
OLD | NEW |