| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/tests/fake_browser_ppapi/fake_url_request_info.h" | 7 #include "native_client/tests/fake_browser_ppapi/fake_url_request_info.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "native_client/src/include/nacl_macros.h" | 11 #include "native_client/src/include/nacl_macros.h" |
| 12 #include "native_client/src/include/portability.h" | 12 #include "native_client/src/include/portability.h" |
| 13 #include "native_client/src/shared/ppapi_proxy/plugin_var.h" | 13 #include "native_client/src/shared/ppapi_proxy/plugin_var.h" |
| 14 | 14 |
| 15 #include "native_client/tests/fake_browser_ppapi/fake_resource.h" | 15 #include "native_client/tests/fake_browser_ppapi/fake_resource.h" |
| 16 #include "native_client/tests/fake_browser_ppapi/utility.h" | 16 #include "native_client/tests/fake_browser_ppapi/utility.h" |
| 17 | 17 |
| 18 #include "ppapi/c/pp_completion_callback.h" | 18 #include "ppapi/c/pp_completion_callback.h" |
| 19 #include "ppapi/c/pp_resource.h" | 19 #include "ppapi/c/pp_resource.h" |
| 20 #include "ppapi/c/pp_var.h" | 20 #include "ppapi/c/pp_var.h" |
| 21 | 21 |
| 22 using ppapi_proxy::PluginVar; | 22 using ppapi_proxy::PluginVar; |
| 23 using fake_browser_ppapi::DebugPrintf; | 23 using fake_browser_ppapi::DebugPrintf; |
| 24 | 24 |
| 25 namespace fake_browser_ppapi { | 25 namespace fake_browser_ppapi { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 PP_Resource Create(PP_Module module_id) { | 29 PP_Resource Create(PP_Module module_id) { |
| 30 DebugPrintf("URLRequestInfo::Create: module_id=%"NACL_PRId64"\n", module_id); | 30 DebugPrintf("URLRequestInfo::Create: module_id=%"NACL_PRId32"\n", module_id); |
| 31 URLRequestInfo* request = new URLRequestInfo(module_id); | 31 URLRequestInfo* request = new URLRequestInfo(module_id); |
| 32 PP_Resource resource_id = TrackResource(request); | 32 PP_Resource resource_id = TrackResource(request); |
| 33 DebugPrintf("URLRequestInfo::Create: resource_id=%"NACL_PRId64"\n", | 33 DebugPrintf("URLRequestInfo::Create: resource_id=%"NACL_PRId32"\n", |
| 34 resource_id); | 34 resource_id); |
| 35 return resource_id; | 35 return resource_id; |
| 36 } | 36 } |
| 37 | 37 |
| 38 PP_Bool IsURLRequestInfo(PP_Resource resource_id) { | 38 PP_Bool IsURLRequestInfo(PP_Resource resource_id) { |
| 39 DebugPrintf("URLRequestInfo::IsURLRequestInfo: resource_id=%"NACL_PRId64"\n", | 39 DebugPrintf("URLRequestInfo::IsURLRequestInfo: resource_id=%"NACL_PRId32"\n", |
| 40 resource_id); | 40 resource_id); |
| 41 UNREFERENCED_PARAMETER(resource_id); | 41 UNREFERENCED_PARAMETER(resource_id); |
| 42 NACL_UNIMPLEMENTED(); | 42 NACL_UNIMPLEMENTED(); |
| 43 return PP_FALSE; | 43 return PP_FALSE; |
| 44 } | 44 } |
| 45 | 45 |
| 46 PP_Bool SetProperty(PP_Resource request_id, | 46 PP_Bool SetProperty(PP_Resource request_id, |
| 47 PP_URLRequestProperty property, | 47 PP_URLRequestProperty property, |
| 48 struct PP_Var value) { | 48 struct PP_Var value) { |
| 49 DebugPrintf("URLRequestInfo::SetProperty: request_id=%"NACL_PRId64 | 49 DebugPrintf("URLRequestInfo::SetProperty: request_id=%"NACL_PRId32 |
| 50 " property=%d value.type=%d\n", request_id, property, value.type); | 50 " property=%d value.type=%d\n", request_id, property, value.type); |
| 51 | 51 |
| 52 URLRequestInfo* request = GetResource(request_id)->AsURLRequestInfo(); | 52 URLRequestInfo* request = GetResource(request_id)->AsURLRequestInfo(); |
| 53 if (request == NULL) | 53 if (request == NULL) |
| 54 return PP_FALSE; | 54 return PP_FALSE; |
| 55 | 55 |
| 56 if (value.type == PP_VARTYPE_BOOL) { | 56 if (value.type == PP_VARTYPE_BOOL) { |
| 57 switch (property) { | 57 switch (property) { |
| 58 case PP_URLREQUESTPROPERTY_STREAMTOFILE: | 58 case PP_URLREQUESTPROPERTY_STREAMTOFILE: |
| 59 request->set_stream_to_file(value.value.as_bool == PP_TRUE); | 59 request->set_stream_to_file(value.value.as_bool == PP_TRUE); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return PP_FALSE; | 92 return PP_FALSE; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 return PP_FALSE; | 96 return PP_FALSE; |
| 97 } | 97 } |
| 98 | 98 |
| 99 PP_Bool AppendDataToBody(PP_Resource request_id, | 99 PP_Bool AppendDataToBody(PP_Resource request_id, |
| 100 const char* data, | 100 const char* data, |
| 101 uint32_t len) { | 101 uint32_t len) { |
| 102 DebugPrintf("URLRequestInfo::AppendDataToBody: request_id=%"NACL_PRId64"\n", | 102 DebugPrintf("URLRequestInfo::AppendDataToBody: request_id=%"NACL_PRId32"\n", |
| 103 request_id); | 103 request_id); |
| 104 UNREFERENCED_PARAMETER(data); | 104 UNREFERENCED_PARAMETER(data); |
| 105 UNREFERENCED_PARAMETER(len); | 105 UNREFERENCED_PARAMETER(len); |
| 106 NACL_UNIMPLEMENTED(); | 106 NACL_UNIMPLEMENTED(); |
| 107 return PP_FALSE; | 107 return PP_FALSE; |
| 108 } | 108 } |
| 109 | 109 |
| 110 PP_Bool AppendFileToBody(PP_Resource request_id, | 110 PP_Bool AppendFileToBody(PP_Resource request_id, |
| 111 PP_Resource file_ref, | 111 PP_Resource file_ref, |
| 112 int64_t start_offset, | 112 int64_t start_offset, |
| 113 int64_t number_of_bytes, | 113 int64_t number_of_bytes, |
| 114 PP_Time expected_last_modified_time) { | 114 PP_Time expected_last_modified_time) { |
| 115 DebugPrintf("URLRequestInfo::AppendFileToBody: request_id=%"NACL_PRId64"\n", | 115 DebugPrintf("URLRequestInfo::AppendFileToBody: request_id=%"NACL_PRId32"\n", |
| 116 request_id); | 116 request_id); |
| 117 UNREFERENCED_PARAMETER(file_ref); | 117 UNREFERENCED_PARAMETER(file_ref); |
| 118 UNREFERENCED_PARAMETER(start_offset); | 118 UNREFERENCED_PARAMETER(start_offset); |
| 119 UNREFERENCED_PARAMETER(number_of_bytes); | 119 UNREFERENCED_PARAMETER(number_of_bytes); |
| 120 UNREFERENCED_PARAMETER(expected_last_modified_time); | 120 UNREFERENCED_PARAMETER(expected_last_modified_time); |
| 121 NACL_UNIMPLEMENTED(); | 121 NACL_UNIMPLEMENTED(); |
| 122 return PP_FALSE; | 122 return PP_FALSE; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace | 125 } // namespace |
| 126 | 126 |
| 127 | 127 |
| 128 const PPB_URLRequestInfo* URLRequestInfo::GetInterface() { | 128 const PPB_URLRequestInfo* URLRequestInfo::GetInterface() { |
| 129 static const PPB_URLRequestInfo url_request_info_interface = { | 129 static const PPB_URLRequestInfo url_request_info_interface = { |
| 130 Create, | 130 Create, |
| 131 IsURLRequestInfo, | 131 IsURLRequestInfo, |
| 132 SetProperty, | 132 SetProperty, |
| 133 AppendDataToBody, | 133 AppendDataToBody, |
| 134 AppendFileToBody | 134 AppendFileToBody |
| 135 }; | 135 }; |
| 136 return &url_request_info_interface; | 136 return &url_request_info_interface; |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace fake_browser_ppapi | 139 } // namespace fake_browser_ppapi |
| OLD | NEW |