Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc

Issue 2513423002: [NaCl SDK] Implement FakeURLRequestInfoInterface::AppendDataToBody (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
diff --git a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
index 00ff72557c76f2b4fdcbd065b2d68b56d098b745..1df756d4f5f93b9a3b97457c299eca67b05834e8 100644
--- a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
@@ -481,8 +481,20 @@ PP_Bool FakeURLRequestInfoInterface::SetProperty(PP_Resource request,
PP_Bool FakeURLRequestInfoInterface::AppendDataToBody(PP_Resource request,
const void* data,
uint32_t len) {
- // AppendDataToBody to be supported.
- return PP_FALSE;
+ FakeURLRequestInfoResource* request_resource =
+ core_interface_->resource_manager()->Get<FakeURLRequestInfoResource>(
+ request);
+ if (request_resource == NULL)
+ return PP_FALSE;
+
+ request_resource->body.append(static_cast<const char*>(data), len);
+
+ char len_string[64] = {0};
+ snprintf(len_string, sizeof(len_string), "%u", len);
+
+ SetHeader("Content-Length", len_string, &request_resource->headers);
+
+ return PP_TRUE;
}
FakeURLResponseInfoInterface::FakeURLResponseInfoInterface(
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698