| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "ppapi/c/dev/ppb_file_chooser_dev.h" | 6 #include "ppapi/c/dev/ppb_file_chooser_dev.h" |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/ppb_file_ref.h" | 8 #include "ppapi/c/ppb_file_ref.h" |
| 9 #include "ppapi/proxy/file_chooser_resource.h" | 9 #include "ppapi/proxy/file_chooser_resource.h" |
| 10 #include "ppapi/proxy/locking_resource_releaser.h" | 10 #include "ppapi/proxy/locking_resource_releaser.h" |
| 11 #include "ppapi/proxy/plugin_message_filter.h" |
| 11 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/proxy/ppapi_proxy_test.h" | 13 #include "ppapi/proxy/ppapi_proxy_test.h" |
| 13 #include "ppapi/shared_impl/proxy_lock.h" | 14 #include "ppapi/shared_impl/proxy_lock.h" |
| 14 #include "ppapi/shared_impl/scoped_pp_var.h" | 15 #include "ppapi/shared_impl/scoped_pp_var.h" |
| 15 #include "ppapi/shared_impl/var.h" | 16 #include "ppapi/shared_impl/var.h" |
| 16 #include "ppapi/thunk/thunk.h" | 17 #include "ppapi/thunk/thunk.h" |
| 17 | 18 |
| 18 namespace ppapi { | 19 namespace ppapi { |
| 19 namespace proxy { | 20 namespace proxy { |
| 20 | 21 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Synthesize a response with one file ref in it. Note that it must have a | 95 // Synthesize a response with one file ref in it. Note that it must have a |
| 95 // pending_host_resource_id set. Since there isn't actually a host, this can | 96 // pending_host_resource_id set. Since there isn't actually a host, this can |
| 96 // be whatever we want. | 97 // be whatever we want. |
| 97 std::vector<FileRefCreateInfo> create_info_array; | 98 std::vector<FileRefCreateInfo> create_info_array; |
| 98 FileRefCreateInfo create_info; | 99 FileRefCreateInfo create_info; |
| 99 create_info.file_system_type = PP_FILESYSTEMTYPE_EXTERNAL; | 100 create_info.file_system_type = PP_FILESYSTEMTYPE_EXTERNAL; |
| 100 create_info.display_name = "bar"; | 101 create_info.display_name = "bar"; |
| 101 create_info.browser_pending_host_resource_id = 12; | 102 create_info.browser_pending_host_resource_id = 12; |
| 102 create_info.renderer_pending_host_resource_id = 15; | 103 create_info.renderer_pending_host_resource_id = 15; |
| 103 create_info_array.push_back(create_info); | 104 create_info_array.push_back(create_info); |
| 104 ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( | 105 PluginMessageFilter::DispatchResourceReplyForTest( |
| 105 PpapiPluginMsg_ResourceReply(reply_params, | 106 reply_params, PpapiPluginMsg_FileChooser_ShowReply(create_info_array)); |
| 106 PpapiPluginMsg_FileChooser_ShowReply(create_info_array)))); | |
| 107 | 107 |
| 108 // Should have populated our vector. | 108 // Should have populated our vector. |
| 109 ASSERT_EQ(1u, dest.size()); | 109 ASSERT_EQ(1u, dest.size()); |
| 110 LockingResourceReleaser dest_deletor(dest[0]); // Ensure it's cleaned up. | 110 LockingResourceReleaser dest_deletor(dest[0]); // Ensure it's cleaned up. |
| 111 | 111 |
| 112 const PPB_FileRef_1_0* file_ref_iface = thunk::GetPPB_FileRef_1_0_Thunk(); | 112 const PPB_FileRef_1_0* file_ref_iface = thunk::GetPPB_FileRef_1_0_Thunk(); |
| 113 EXPECT_EQ(PP_FILESYSTEMTYPE_EXTERNAL, | 113 EXPECT_EQ(PP_FILESYSTEMTYPE_EXTERNAL, |
| 114 file_ref_iface->GetFileSystemType(dest[0])); | 114 file_ref_iface->GetFileSystemType(dest[0])); |
| 115 | 115 |
| 116 PP_Var name_var(file_ref_iface->GetName(dest[0])); | 116 PP_Var name_var(file_ref_iface->GetName(dest[0])); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 138 EXPECT_TRUE(CheckParseAcceptType(" app/txt , app/pdf ", | 138 EXPECT_TRUE(CheckParseAcceptType(" app/txt , app/pdf ", |
| 139 "app/txt", "app/pdf")); | 139 "app/txt", "app/pdf")); |
| 140 | 140 |
| 141 // No dot or slash ones should be skipped. | 141 // No dot or slash ones should be skipped. |
| 142 EXPECT_TRUE(CheckParseAcceptType("foo", NULL, NULL)); | 142 EXPECT_TRUE(CheckParseAcceptType("foo", NULL, NULL)); |
| 143 EXPECT_TRUE(CheckParseAcceptType("foo,.txt", ".txt", NULL)); | 143 EXPECT_TRUE(CheckParseAcceptType("foo,.txt", ".txt", NULL)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace proxy | 146 } // namespace proxy |
| 147 } // namespace ppapi | 147 } // namespace ppapi |
| OLD | NEW |