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

Side by Side Diff: tests/fake_browser_ppapi/fake_url_response_info.cc

Issue 6218004: Resource64->32, NaCl side. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: First Created 9 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_response_info.h" 7 #include "native_client/tests/fake_browser_ppapi/fake_url_response_info.h"
8 8
9 #include <stdio.h> 9 #include <stdio.h>
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_file_ref.h" 15 #include "native_client/tests/fake_browser_ppapi/fake_file_ref.h"
16 #include "native_client/tests/fake_browser_ppapi/fake_resource.h" 16 #include "native_client/tests/fake_browser_ppapi/fake_resource.h"
17 #include "native_client/tests/fake_browser_ppapi/utility.h" 17 #include "native_client/tests/fake_browser_ppapi/utility.h"
18 18
19 #include "ppapi/c/pp_completion_callback.h" 19 #include "ppapi/c/pp_completion_callback.h"
20 #include "ppapi/c/pp_resource.h" 20 #include "ppapi/c/pp_resource.h"
21 21
22 using fake_browser_ppapi::DebugPrintf; 22 using fake_browser_ppapi::DebugPrintf;
23 using ppapi_proxy::PluginVar; 23 using ppapi_proxy::PluginVar;
24 24
25 namespace fake_browser_ppapi { 25 namespace fake_browser_ppapi {
26 26
27 namespace { 27 namespace {
28 28
29 PP_Bool IsURLResponseInfo(PP_Resource resource_id) { 29 PP_Bool IsURLResponseInfo(PP_Resource resource_id) {
30 DebugPrintf("URLRequestInfo::IsURLResponseInfo: resource_id=%"NACL_PRId64"\n", 30 DebugPrintf("URLRequestInfo::IsURLResponseInfo: resource_id=%"NACL_PRId32"\n",
31 resource_id); 31 resource_id);
32 NACL_UNIMPLEMENTED(); 32 NACL_UNIMPLEMENTED();
33 return PP_FALSE; 33 return PP_FALSE;
34 } 34 }
35 35
36 PP_Var GetProperty(PP_Resource response_id, 36 PP_Var GetProperty(PP_Resource response_id,
37 PP_URLResponseProperty property) { 37 PP_URLResponseProperty property) {
38 DebugPrintf("URLRequestInfo::GetProperty: response_id=%"NACL_PRId64"\n", 38 DebugPrintf("URLRequestInfo::GetProperty: response_id=%"NACL_PRId32"\n",
39 response_id); 39 response_id);
40 URLResponseInfo* response = GetResource(response_id)->AsURLResponseInfo(); 40 URLResponseInfo* response = GetResource(response_id)->AsURLResponseInfo();
41 if (response == NULL) 41 if (response == NULL)
42 return PP_MakeUndefined(); 42 return PP_MakeUndefined();
43 43
44 switch (property) { 44 switch (property) {
45 case PP_URLRESPONSEPROPERTY_URL: 45 case PP_URLRESPONSEPROPERTY_URL:
46 return PluginVar::StringToPPVar(response->module_id(), response->url()); 46 return PluginVar::StringToPPVar(response->module_id(), response->url());
47 case PP_URLRESPONSEPROPERTY_STATUSCODE: 47 case PP_URLRESPONSEPROPERTY_STATUSCODE:
48 return PP_MakeInt32(response->status_code()); 48 return PP_MakeInt32(response->status_code());
49 case PP_URLRESPONSEPROPERTY_HEADERS: 49 case PP_URLRESPONSEPROPERTY_HEADERS:
50 case PP_URLRESPONSEPROPERTY_REDIRECTURL: 50 case PP_URLRESPONSEPROPERTY_REDIRECTURL:
51 case PP_URLRESPONSEPROPERTY_REDIRECTMETHOD: 51 case PP_URLRESPONSEPROPERTY_REDIRECTMETHOD:
52 case PP_URLRESPONSEPROPERTY_STATUSLINE: 52 case PP_URLRESPONSEPROPERTY_STATUSLINE:
53 NACL_UNIMPLEMENTED(); 53 NACL_UNIMPLEMENTED();
54 } 54 }
55 return PP_MakeUndefined(); 55 return PP_MakeUndefined();
56 } 56 }
57 57
58 PP_Resource GetBodyAsFileRef(PP_Resource response_id) { 58 PP_Resource GetBodyAsFileRef(PP_Resource response_id) {
59 DebugPrintf("URLRequestInfo::GetBodyAsFileRef: response_id=%"NACL_PRId64"\n", 59 DebugPrintf("URLRequestInfo::GetBodyAsFileRef: response_id=%"NACL_PRId32"\n",
60 response_id); 60 response_id);
61 URLResponseInfo* response = GetResource(response_id)->AsURLResponseInfo(); 61 URLResponseInfo* response = GetResource(response_id)->AsURLResponseInfo();
62 if (response == NULL) 62 if (response == NULL)
63 return Resource::Invalid()->resource_id(); 63 return Resource::Invalid()->resource_id();
64 FileRef* file_ref = response->body_as_file_ref(); 64 FileRef* file_ref = response->body_as_file_ref();
65 CHECK(file_ref != NULL); 65 CHECK(file_ref != NULL);
66 return file_ref->resource_id(); 66 return file_ref->resource_id();
67 } 67 }
68 68
69 } // namespace 69 } // namespace
70 70
71 71
72 const PPB_URLResponseInfo* URLResponseInfo::GetInterface() { 72 const PPB_URLResponseInfo* URLResponseInfo::GetInterface() {
73 static const PPB_URLResponseInfo url_response_info_interface = { 73 static const PPB_URLResponseInfo url_response_info_interface = {
74 IsURLResponseInfo, 74 IsURLResponseInfo,
75 GetProperty, 75 GetProperty,
76 GetBodyAsFileRef 76 GetBodyAsFileRef
77 }; 77 };
78 return &url_response_info_interface; 78 return &url_response_info_interface;
79 } 79 }
80 80
81 } // namespace fake_browser_ppapi 81 } // namespace fake_browser_ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698