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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/public/test/render_view_test.h" | 8 #include "content/public/test/render_view_test.h" |
9 #include "content/public/common/file_chooser_params.h" | 9 #include "content/public/common/file_chooser_params.h" |
10 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 10 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // Basic validation of request. | 121 // Basic validation of request. |
122 EXPECT_EQ(FileChooserParams::Open, chooser_params.mode); | 122 EXPECT_EQ(FileChooserParams::Open, chooser_params.mode); |
123 ASSERT_EQ(1u, chooser_params.accept_types.size()); | 123 ASSERT_EQ(1u, chooser_params.accept_types.size()); |
124 EXPECT_EQ(accept[0], UTF16ToUTF8(chooser_params.accept_types[0])); | 124 EXPECT_EQ(accept[0], UTF16ToUTF8(chooser_params.accept_types[0])); |
125 | 125 |
126 // Send a chooser reply to the render view. Note our reply path has to have a | 126 // Send a chooser reply to the render view. Note our reply path has to have a |
127 // path separator so we include both a Unix and a Windows one. | 127 // path separator so we include both a Unix and a Windows one. |
128 ui::SelectedFileInfo selected_info; | 128 ui::SelectedFileInfo selected_info; |
129 selected_info.display_name = FILE_PATH_LITERAL("Hello, world"); | 129 selected_info.display_name = FILE_PATH_LITERAL("Hello, world"); |
130 selected_info.path = FilePath(FILE_PATH_LITERAL("myp\\ath/foo")); | 130 selected_info.local_path = FilePath(FILE_PATH_LITERAL("myp\\ath/foo")); |
131 std::vector<ui::SelectedFileInfo> selected_info_vector; | 131 std::vector<ui::SelectedFileInfo> selected_info_vector; |
132 selected_info_vector.push_back(selected_info); | 132 selected_info_vector.push_back(selected_info); |
133 ViewMsg_RunFileChooserResponse response(view_impl->routing_id(), | 133 ViewMsg_RunFileChooserResponse response(view_impl->routing_id(), |
134 selected_info_vector); | 134 selected_info_vector); |
135 EXPECT_TRUE(view_impl->OnMessageReceived(response)); | 135 EXPECT_TRUE(view_impl->OnMessageReceived(response)); |
136 | 136 |
137 // This should have sent the Pepper reply to our test sink. | 137 // This should have sent the Pepper reply to our test sink. |
138 ppapi::proxy::ResourceMessageReplyParams reply_params; | 138 ppapi::proxy::ResourceMessageReplyParams reply_params; |
139 IPC::Message reply_msg; | 139 IPC::Message reply_msg; |
140 ASSERT_TRUE(sink.GetFirstResourceReplyMatching( | 140 ASSERT_TRUE(sink.GetFirstResourceReplyMatching( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 accept.push_back("text/plain"); | 172 accept.push_back("text/plain"); |
173 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 173 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
174 | 174 |
175 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); | 175 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); |
176 ppapi::host::HostMessageContext context(call_params); | 176 ppapi::host::HostMessageContext context(call_params); |
177 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); | 177 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); |
178 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); | 178 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); |
179 } | 179 } |
180 | 180 |
181 } // namespace content | 181 } // namespace content |
OLD | NEW |