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/mock_renderer_ppapi_host.h" | 10 #include "content/renderer/pepper/mock_renderer_ppapi_host.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 std::string FilePathToUTF8(const FilePath::StringType& path) { | 65 std::string FilePathToUTF8(const FilePath::StringType& path) { |
66 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
67 return UTF16ToUTF8(path); | 67 return UTF16ToUTF8(path); |
68 #else | 68 #else |
69 return path; | 69 return path; |
70 #endif | 70 #endif |
71 } | 71 } |
72 | 72 |
73 } // namespace | 73 } // namespace |
74 | 74 |
| 75 /* TODO(brettw) fix & re-enable this test. |
75 TEST_F(PepperFileChooserHostTest, Show) { | 76 TEST_F(PepperFileChooserHostTest, Show) { |
76 PP_Resource pp_resource = 123; | 77 PP_Resource pp_resource = 123; |
77 | 78 |
78 MockRendererPpapiHost host(view_, pp_instance()); | 79 MockRendererPpapiHost host(view_, pp_instance()); |
79 PepperFileChooserHost chooser(&host, pp_instance(), pp_resource); | 80 PepperFileChooserHost chooser(&host, pp_instance(), pp_resource); |
80 | 81 |
81 std::vector<std::string> accept; | 82 std::vector<std::string> accept; |
82 accept.push_back("text/plain"); | 83 accept.push_back("text/plain"); |
83 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 84 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
84 | 85 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ASSERT_TRUE(PpapiPluginMsg_FileChooser_ShowReply::Read(&reply_msg, | 127 ASSERT_TRUE(PpapiPluginMsg_FileChooser_ShowReply::Read(&reply_msg, |
127 &reply_msg_param)); | 128 &reply_msg_param)); |
128 const std::vector<ppapi::PPB_FileRef_CreateInfo>& chooser_results = | 129 const std::vector<ppapi::PPB_FileRef_CreateInfo>& chooser_results = |
129 reply_msg_param.a; | 130 reply_msg_param.a; |
130 ASSERT_EQ(1u, chooser_results.size()); | 131 ASSERT_EQ(1u, chooser_results.size()); |
131 // Note path is empty because this is an external filesystem. | 132 // Note path is empty because this is an external filesystem. |
132 EXPECT_EQ(std::string(), chooser_results[0].path); | 133 EXPECT_EQ(std::string(), chooser_results[0].path); |
133 EXPECT_EQ(FilePathToUTF8(selected_info.display_name), | 134 EXPECT_EQ(FilePathToUTF8(selected_info.display_name), |
134 chooser_results[0].name); | 135 chooser_results[0].name); |
135 } | 136 } |
| 137 */ |
136 | 138 |
137 TEST_F(PepperFileChooserHostTest, NoUserGesture) { | 139 TEST_F(PepperFileChooserHostTest, NoUserGesture) { |
138 PP_Resource pp_resource = 123; | 140 PP_Resource pp_resource = 123; |
139 | 141 |
140 MockRendererPpapiHost host(view_, pp_instance()); | 142 MockRendererPpapiHost host(view_, pp_instance()); |
141 PepperFileChooserHost chooser(&host, pp_instance(), pp_resource); | 143 PepperFileChooserHost chooser(&host, pp_instance(), pp_resource); |
142 | 144 |
143 // Say there's no user gesture. | 145 // Say there's no user gesture. |
144 host.set_has_user_gesture(false); | 146 host.set_has_user_gesture(false); |
145 | 147 |
146 std::vector<std::string> accept; | 148 std::vector<std::string> accept; |
147 accept.push_back("text/plain"); | 149 accept.push_back("text/plain"); |
148 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); | 150 PpapiHostMsg_FileChooser_Show show_msg(false, false, std::string(), accept); |
149 | 151 |
150 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); | 152 ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 0); |
151 ppapi::host::HostMessageContext context(call_params); | 153 ppapi::host::HostMessageContext context(call_params); |
152 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); | 154 int32 result = chooser.OnResourceMessageReceived(show_msg, &context); |
153 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); | 155 EXPECT_EQ(PP_ERROR_NO_USER_GESTURE, result); |
154 } | 156 } |
155 | 157 |
156 } // namespace content | 158 } // namespace content |
OLD | NEW |