misc.c (11d1bab6) | misc.c (98e4a3ec) |
---|---|
1/* 2 * Copyright 2005-2006 Jacek Caban for CodeWeavers 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * --- 47 unchanged lines hidden (view full) --- 56 57#define CHECK_CALLED(func) \ 58 do { \ 59 ok(called_ ## func, "expected " #func "\n"); \ 60 expect_ ## func = called_ ## func = FALSE; \ 61 }while(0) 62 63DEFINE_EXPECT(ParseUrl); | 1/* 2 * Copyright 2005-2006 Jacek Caban for CodeWeavers 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * --- 47 unchanged lines hidden (view full) --- 56 57#define CHECK_CALLED(func) \ 58 do { \ 59 ok(called_ ## func, "expected " #func "\n"); \ 60 expect_ ## func = called_ ## func = FALSE; \ 61 }while(0) 62 63DEFINE_EXPECT(ParseUrl); |
64DEFINE_EXPECT(ParseUrl_ENCODE); 65DEFINE_EXPECT(ParseUrl_UNESCAPE); |
|
64DEFINE_EXPECT(QI_IInternetProtocolInfo); 65DEFINE_EXPECT(CreateInstance); 66DEFINE_EXPECT(unk_Release); 67 68static HRESULT (WINAPI *pCoInternetCompareUrl)(LPCWSTR, LPCWSTR, DWORD); 69static HRESULT (WINAPI *pCoInternetGetSecurityUrl)(LPCWSTR, LPWSTR*, PSUACTION, DWORD); 70static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD); 71static HRESULT (WINAPI *pCoInternetParseUrl)(LPCWSTR, PARSEACTION, DWORD, LPWSTR, DWORD, DWORD *, DWORD); --- 305 unchanged lines hidden (view full) --- 377 memset(buf, 0xf0, sizeof(buf)); 378 hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf, 379 ARRAY_SIZE(buf), &size, 0); 380 ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres); 381 ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i); 382 ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i); 383 384 memset(buf, 0xf0, sizeof(buf)); | 66DEFINE_EXPECT(QI_IInternetProtocolInfo); 67DEFINE_EXPECT(CreateInstance); 68DEFINE_EXPECT(unk_Release); 69 70static HRESULT (WINAPI *pCoInternetCompareUrl)(LPCWSTR, LPCWSTR, DWORD); 71static HRESULT (WINAPI *pCoInternetGetSecurityUrl)(LPCWSTR, LPWSTR*, PSUACTION, DWORD); 72static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD); 73static HRESULT (WINAPI *pCoInternetParseUrl)(LPCWSTR, PARSEACTION, DWORD, LPWSTR, DWORD, DWORD *, DWORD); --- 305 unchanged lines hidden (view full) --- 379 memset(buf, 0xf0, sizeof(buf)); 380 hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf, 381 ARRAY_SIZE(buf), &size, 0); 382 ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres); 383 ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i); 384 ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i); 385 386 memset(buf, 0xf0, sizeof(buf)); |
387 hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_UNESCAPE, 0, buf, 388 ARRAY_SIZE(buf), &size, 0); 389 ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres); 390 ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i); 391 ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i); 392 393 memset(buf, 0xf0, sizeof(buf)); |
|
385 hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf, 386 ARRAY_SIZE(buf), &size, 0); 387 ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n", 388 i, hres, parse_tests[i].path_hres); 389 if(parse_tests[i].path) { 390 ok(size == lstrlenW(parse_tests[i].path), "[%d] wrong size\n", i); 391 ok(!lstrcmpW(parse_tests[i].path, buf), "[%d] wrong path\n", i); 392 } --- 477 unchanged lines hidden (view full) --- 870{ 871 return 1; 872} 873 874static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, 875 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, 876 DWORD *pcchResult, DWORD dwReserved) 877{ | 394 hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf, 395 ARRAY_SIZE(buf), &size, 0); 396 ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n", 397 i, hres, parse_tests[i].path_hres); 398 if(parse_tests[i].path) { 399 ok(size == lstrlenW(parse_tests[i].path), "[%d] wrong size\n", i); 400 ok(!lstrcmpW(parse_tests[i].path, buf), "[%d] wrong path\n", i); 401 } --- 477 unchanged lines hidden (view full) --- 879{ 880 return 1; 881} 882 883static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, 884 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, 885 DWORD *pcchResult, DWORD dwReserved) 886{ |
878 CHECK_EXPECT2(ParseUrl); 879 880 if(ParseAction == PARSE_SECURITY_URL) { | 887 switch(ParseAction) { 888 case PARSE_SECURITY_URL: 889 CHECK_EXPECT2(ParseUrl); |
881 if(pcchResult) 882 *pcchResult = ARRAY_SIZE(url1); 883 884 if(cchResult < ARRAY_SIZE(url1)) 885 return S_FALSE; 886 887 memcpy(pwzResult, url1, sizeof(url1)); 888 return S_OK; | 890 if(pcchResult) 891 *pcchResult = ARRAY_SIZE(url1); 892 893 if(cchResult < ARRAY_SIZE(url1)) 894 return S_FALSE; 895 896 memcpy(pwzResult, url1, sizeof(url1)); 897 return S_OK; |
898 case PARSE_ENCODE: 899 CHECK_EXPECT2(ParseUrl_ENCODE); 900 break; 901 902 case PARSE_UNESCAPE: 903 CHECK_EXPECT2(ParseUrl_UNESCAPE); 904 break; 905 906 default: 907 CHECK_EXPECT2(ParseUrl); 908 break; |
|
889 } 890 891 return E_NOTIMPL; 892} 893 894static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, 895 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, 896 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved) --- 128 unchanged lines hidden (view full) --- 1025 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, 1026 wszTest, 0, NULL, 0); 1027 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres); 1028 1029 qiret = E_NOINTERFACE; 1030 expect_cf = &test_protocol_cf; 1031 SET_EXPECT(QI_IInternetProtocolInfo); 1032 SET_EXPECT(CreateInstance); | 909 } 910 911 return E_NOTIMPL; 912} 913 914static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, 915 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, 916 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved) --- 128 unchanged lines hidden (view full) --- 1045 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, 1046 wszTest, 0, NULL, 0); 1047 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres); 1048 1049 qiret = E_NOINTERFACE; 1050 expect_cf = &test_protocol_cf; 1051 SET_EXPECT(QI_IInternetProtocolInfo); 1052 SET_EXPECT(CreateInstance); |
1033 SET_EXPECT(ParseUrl); | 1053 SET_EXPECT(ParseUrl_ENCODE); |
1034 1035 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1036 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1037 1038 CHECK_CALLED(QI_IInternetProtocolInfo); 1039 CHECK_CALLED(CreateInstance); | 1054 1055 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1056 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1057 1058 CHECK_CALLED(QI_IInternetProtocolInfo); 1059 CHECK_CALLED(CreateInstance); |
1040 CHECK_CALLED(ParseUrl); | 1060 CHECK_CALLED(ParseUrl_ENCODE); |
1041 1042 qiret = S_OK; 1043 SET_EXPECT(QI_IInternetProtocolInfo); | 1061 1062 qiret = S_OK; 1063 SET_EXPECT(QI_IInternetProtocolInfo); |
1044 SET_EXPECT(ParseUrl); | 1064 SET_EXPECT(ParseUrl_ENCODE); |
1045 1046 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1047 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1048 1049 CHECK_CALLED(QI_IInternetProtocolInfo); | 1065 1066 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1067 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1068 1069 CHECK_CALLED(QI_IInternetProtocolInfo); |
1050 CHECK_CALLED(ParseUrl); | 1070 CHECK_CALLED(ParseUrl_ENCODE); |
1051 | 1071 |
1072 qiret = S_OK; |
|
1052 SET_EXPECT(QI_IInternetProtocolInfo); | 1073 SET_EXPECT(QI_IInternetProtocolInfo); |
1074 SET_EXPECT(ParseUrl_UNESCAPE); 1075 1076 hres = pCoInternetParseUrl(url8, PARSE_UNESCAPE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1077 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1078 1079 CHECK_CALLED(QI_IInternetProtocolInfo); 1080 CHECK_CALLED(ParseUrl_UNESCAPE); 1081 1082 SET_EXPECT(QI_IInternetProtocolInfo); |
|
1053 SET_EXPECT(ParseUrl); 1054 1055 hres = pCoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf, ARRAY_SIZE(buf), &size, 0); 1056 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1057 ok(size == ARRAY_SIZE(url1), "Size = %d\n", size); 1058 if(size == ARRAY_SIZE(url1)) 1059 ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf)); 1060 --- 31 unchanged lines hidden (view full) --- 1092 wszTest, 0, NULL, 0); 1093 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres); 1094 1095 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, 1096 wszTest, 0, NULL, 0); 1097 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres); 1098 1099 SET_EXPECT(QI_IInternetProtocolInfo); | 1083 SET_EXPECT(ParseUrl); 1084 1085 hres = pCoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf, ARRAY_SIZE(buf), &size, 0); 1086 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1087 ok(size == ARRAY_SIZE(url1), "Size = %d\n", size); 1088 if(size == ARRAY_SIZE(url1)) 1089 ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf)); 1090 --- 31 unchanged lines hidden (view full) --- 1122 wszTest, 0, NULL, 0); 1123 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres); 1124 1125 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, 1126 wszTest, 0, NULL, 0); 1127 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres); 1128 1129 SET_EXPECT(QI_IInternetProtocolInfo); |
1100 SET_EXPECT(ParseUrl); | 1130 SET_EXPECT(ParseUrl_ENCODE); |
1101 1102 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1103 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1104 1105 CHECK_CALLED(QI_IInternetProtocolInfo); | 1131 1132 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1133 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1134 1135 CHECK_CALLED(QI_IInternetProtocolInfo); |
1106 CHECK_CALLED(ParseUrl); | 1136 CHECK_CALLED(ParseUrl_ENCODE); |
1107 1108 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1109 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1110 1111 SET_EXPECT(QI_IInternetProtocolInfo); | 1137 1138 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1139 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1140 1141 SET_EXPECT(QI_IInternetProtocolInfo); |
1112 SET_EXPECT(ParseUrl); | 1142 SET_EXPECT(ParseUrl_ENCODE); |
1113 1114 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1115 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1116 1117 CHECK_CALLED(QI_IInternetProtocolInfo); | 1143 1144 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1145 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1146 1147 CHECK_CALLED(QI_IInternetProtocolInfo); |
1118 CHECK_CALLED(ParseUrl); | 1148 CHECK_CALLED(ParseUrl_ENCODE); |
1119 1120 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1121 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1122 1123 expect_cf = &test_protocol_cf2; 1124 SET_EXPECT(QI_IInternetProtocolInfo); | 1149 1150 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1151 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1152 1153 expect_cf = &test_protocol_cf2; 1154 SET_EXPECT(QI_IInternetProtocolInfo); |
1125 SET_EXPECT(ParseUrl); | 1155 SET_EXPECT(ParseUrl_ENCODE); |
1126 1127 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1128 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1129 1130 CHECK_CALLED(QI_IInternetProtocolInfo); | 1156 1157 hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); 1158 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); 1159 1160 CHECK_CALLED(QI_IInternetProtocolInfo); |
1131 CHECK_CALLED(ParseUrl); | 1161 CHECK_CALLED(ParseUrl_ENCODE); |
1132 1133 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1134 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1135 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1136 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1137 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, NULL); 1138 ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres); 1139 hres = IInternetSession_UnregisterNameSpace(session, NULL, wszTest); --- 1555 unchanged lines hidden --- | 1162 1163 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1164 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1165 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); 1166 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); 1167 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, NULL); 1168 ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres); 1169 hres = IInternetSession_UnregisterNameSpace(session, NULL, wszTest); --- 1555 unchanged lines hidden --- |