| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 EXPECT_EQ(accept[0], base::UTF16ToUTF8(chooser_params.accept_types[0])); | 103 EXPECT_EQ(accept[0], base::UTF16ToUTF8(chooser_params.accept_types[0])); |
| 104 | 104 |
| 105 // Send a chooser reply to the render view. Note our reply path has to have a | 105 // Send a chooser reply to the render view. Note our reply path has to have a |
| 106 // path separator so we include both a Unix and a Windows one. | 106 // path separator so we include both a Unix and a Windows one. |
| 107 content::FileChooserFileInfo selected_info; | 107 content::FileChooserFileInfo selected_info; |
| 108 selected_info.display_name = FILE_PATH_LITERAL("Hello, world"); | 108 selected_info.display_name = FILE_PATH_LITERAL("Hello, world"); |
| 109 selected_info.file_path = base::FilePath(FILE_PATH_LITERAL("myp\\ath/foo")); | 109 selected_info.file_path = base::FilePath(FILE_PATH_LITERAL("myp\\ath/foo")); |
| 110 std::vector<content::FileChooserFileInfo> selected_info_vector; | 110 std::vector<content::FileChooserFileInfo> selected_info_vector; |
| 111 selected_info_vector.push_back(selected_info); | 111 selected_info_vector.push_back(selected_info); |
| 112 RenderViewImpl* view_impl = static_cast<RenderViewImpl*>(view_); | 112 RenderViewImpl* view_impl = static_cast<RenderViewImpl*>(view_); |
| 113 ViewMsg_RunFileChooserResponse response(view_impl->GetRoutingID(), | 113 ViewMsg_RunFileChooserResponse response(view_impl->routing_id(), |
| 114 selected_info_vector); | 114 selected_info_vector); |
| 115 EXPECT_TRUE(view_impl->OnMessageReceived(response)); | 115 EXPECT_TRUE(view_impl->OnMessageReceived(response)); |
| 116 | 116 |
| 117 // This should have sent the Pepper reply to our test sink. | 117 // This should have sent the Pepper reply to our test sink. |
| 118 ppapi::proxy::ResourceMessageReplyParams reply_params; | 118 ppapi::proxy::ResourceMessageReplyParams reply_params; |
| 119 IPC::Message reply_msg; | 119 IPC::Message reply_msg; |
| 120 ASSERT_TRUE(host.sink().GetFirstResourceReplyMatching( | 120 ASSERT_TRUE(host.sink().GetFirstResourceReplyMatching( |
| 121 PpapiPluginMsg_FileChooser_ShowReply::ID, &reply_params, &reply_msg)); | 121 PpapiPluginMsg_FileChooser_ShowReply::ID, &reply_params, &reply_msg)); |
| 122 | 122 |
| 123 // Basic validation of reply. | 123 // Basic validation of reply. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 146 accept.push_back("text/plain"); | 146 accept.push_back("text/plain"); |
| 147 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 147 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
| 148 | 148 |
| 149 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); | 149 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); |
| 150 ppapi::host::HostMessageContext context(call_params); | 150 ppapi::host::HostMessageContext context(call_params); |
| 151 int32_t result = chooser.OnResourceMessageReceived(show_msg, &context); | 151 int32_t result = chooser.OnResourceMessageReceived(show_msg, &context); |
| 152 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); | 152 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace content | 155 } // namespace content |
| OLD | NEW |