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> |
| 6 |
5 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
6 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" |
7 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
8 #include "content/public/common/file_chooser_file_info.h" | 11 #include "content/public/common/file_chooser_file_info.h" |
9 #include "content/public/common/file_chooser_params.h" | 12 #include "content/public/common/file_chooser_params.h" |
10 #include "content/public/test/render_view_test.h" | 13 #include "content/public/test/render_view_test.h" |
11 #include "content/renderer/pepper/mock_renderer_ppapi_host.h" | 14 #include "content/renderer/pepper/mock_renderer_ppapi_host.h" |
12 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 15 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
13 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
14 #include "content/test/test_content_client.h" | 17 #include "content/test/test_content_client.h" |
15 #include "ppapi/c/pp_errors.h" | 18 #include "ppapi/c/pp_errors.h" |
16 #include "ppapi/host/host_message_context.h" | 19 #include "ppapi/host/host_message_context.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 78 |
76 // Say there's a user gesture. | 79 // Say there's a user gesture. |
77 host.set_has_user_gesture(true); | 80 host.set_has_user_gesture(true); |
78 | 81 |
79 std::vector<std::string> accept; | 82 std::vector<std::string> accept; |
80 accept.push_back("text/plain"); | 83 accept.push_back("text/plain"); |
81 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 84 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
82 | 85 |
83 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); | 86 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); |
84 ppapi::host::HostMessageContext context(call_params); | 87 ppapi::host::HostMessageContext context(call_params); |
85 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); | 88 int32_t result = chooser.OnResourceMessageReceived(show_msg, &context); |
86 EXPECT_EQ(PP_OK_COMPLETIONPENDING, result); | 89 EXPECT_EQ(PP_OK_COMPLETIONPENDING, result); |
87 | 90 |
88 // The render view should have sent a chooser request to the browser | 91 // The render view should have sent a chooser request to the browser |
89 // (caught by the render thread's test message sink). | 92 // (caught by the render thread's test message sink). |
90 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( | 93 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( |
91 ViewHostMsg_RunFileChooser::ID); | 94 ViewHostMsg_RunFileChooser::ID); |
92 ASSERT_TRUE(msg); | 95 ASSERT_TRUE(msg); |
93 ViewHostMsg_RunFileChooser::Schema::Param call_msg_param; | 96 ViewHostMsg_RunFileChooser::Schema::Param call_msg_param; |
94 ASSERT_TRUE(ViewHostMsg_RunFileChooser::Read(msg, &call_msg_param)); | 97 ASSERT_TRUE(ViewHostMsg_RunFileChooser::Read(msg, &call_msg_param)); |
95 const FileChooserParams& chooser_params = base::get<0>(call_msg_param); | 98 const FileChooserParams& chooser_params = base::get<0>(call_msg_param); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 141 |
139 // Say there's no user gesture. | 142 // Say there's no user gesture. |
140 host.set_has_user_gesture(false); | 143 host.set_has_user_gesture(false); |
141 | 144 |
142 std::vector<std::string> accept; | 145 std::vector<std::string> accept; |
143 accept.push_back("text/plain"); | 146 accept.push_back("text/plain"); |
144 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 147 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
145 | 148 |
146 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); | 149 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); |
147 ppapi::host::HostMessageContext context(call_params); | 150 ppapi::host::HostMessageContext context(call_params); |
148 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); | 151 int32_t result = chooser.OnResourceMessageReceived(show_msg, &context); |
149 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); | 152 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); |
150 } | 153 } |
151 | 154 |
152 } // namespace content | 155 } // namespace content |
OLD | NEW |