| 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> |
| 11 | 11 |
| 12 #include "ppapi/c/pp_var.h" | 12 #include "ppapi/c/pp_var.h" |
| 13 #include "ppapi/c/ppb_file_io.h" | 13 #include "ppapi/c/ppb_file_io.h" |
| 14 #include "ppapi/cpp/dev/var_resource_dev.h" | |
| 15 #include "ppapi/cpp/file_io.h" | 14 #include "ppapi/cpp/file_io.h" |
| 16 #include "ppapi/cpp/file_ref.h" | 15 #include "ppapi/cpp/file_ref.h" |
| 17 #include "ppapi/cpp/file_system.h" | 16 #include "ppapi/cpp/file_system.h" |
| 18 #include "ppapi/cpp/instance.h" | 17 #include "ppapi/cpp/instance.h" |
| 19 #include "ppapi/cpp/var.h" | 18 #include "ppapi/cpp/var.h" |
| 20 #include "ppapi/cpp/var_array.h" | 19 #include "ppapi/cpp/var_array.h" |
| 21 #include "ppapi/cpp/var_array_buffer.h" | 20 #include "ppapi/cpp/var_array_buffer.h" |
| 22 #include "ppapi/cpp/var_dictionary.h" | 21 #include "ppapi/cpp/var_dictionary.h" |
| 23 #include "ppapi/tests/pp_thread.h" | 22 #include "ppapi/tests/pp_thread.h" |
| 24 #include "ppapi/tests/test_utils.h" | 23 #include "ppapi/tests/test_utils.h" |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 js_code += kTestString; | 591 js_code += kTestString; |
| 593 js_code += "'], {'type': 'text/plain'});" | 592 js_code += "'], {'type': 'text/plain'});" |
| 594 " writer.write(blob);" | 593 " writer.write(blob);" |
| 595 " });" | 594 " });" |
| 596 " }, function() { callback(null); });" | 595 " }, function() { callback(null); });" |
| 597 " }, function() { callback(null); });" | 596 " }, function() { callback(null); });" |
| 598 "}"; | 597 "}"; |
| 599 ASSERT_EQ(PostAsyncMessageFromJavaScriptAndWait(js_code), 1); | 598 ASSERT_EQ(PostAsyncMessageFromJavaScriptAndWait(js_code), 1); |
| 600 pp::Var var = message_data_.back(); | 599 pp::Var var = message_data_.back(); |
| 601 ASSERT_TRUE(var.is_resource()); | 600 ASSERT_TRUE(var.is_resource()); |
| 602 pp::VarResource_Dev var_resource(var); | 601 pp::Resource result = var.AsResource(); |
| 603 pp::Resource result = var_resource.AsResource(); | |
| 604 ASSERT_TRUE(pp::FileSystem::IsFileSystem(result)); | 602 ASSERT_TRUE(pp::FileSystem::IsFileSystem(result)); |
| 605 { | 603 { |
| 606 pp::FileSystem file_system(result); | 604 pp::FileSystem file_system(result); |
| 607 std::string file_path("/"); | 605 std::string file_path("/"); |
| 608 file_path += kTestFilename; | 606 file_path += kTestFilename; |
| 609 pp::FileRef file_ref(file_system, file_path.c_str()); | 607 pp::FileRef file_ref(file_system, file_path.c_str()); |
| 610 ASSERT_NE(0, file_ref.pp_resource()); | 608 ASSERT_NE(0, file_ref.pp_resource()); |
| 611 | 609 |
| 612 // Ensure that the file can be queried. | 610 // Ensure that the file can be queried. |
| 613 TestCompletionCallbackWithOutput<PP_FileInfo> cc(instance_->pp_instance(), | 611 TestCompletionCallbackWithOutput<PP_FileInfo> cc(instance_->pp_instance(), |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 ASSERT_TRUE(received_value <= kThreadsToRun); | 867 ASSERT_TRUE(received_value <= kThreadsToRun); |
| 870 ++received_counts[received_value]; | 868 ++received_counts[received_value]; |
| 871 } | 869 } |
| 872 ASSERT_EQ(expected_counts, received_counts); | 870 ASSERT_EQ(expected_counts, received_counts); |
| 873 | 871 |
| 874 message_data_.clear(); | 872 message_data_.clear(); |
| 875 ASSERT_TRUE(ClearListeners()); | 873 ASSERT_TRUE(ClearListeners()); |
| 876 | 874 |
| 877 PASS(); | 875 PASS(); |
| 878 } | 876 } |
| OLD | NEW |