Commit fd3d0113 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

mf/tests: Add some network scheme resolver tests.

parent e2aee50a
......@@ -33,6 +33,7 @@
#include "mmdeviceapi.h"
#include "uuids.h"
#include "wmcodecdsp.h"
#include "nserror.h"
#include "mf_test.h"
......@@ -6432,6 +6433,134 @@ static void test_MFGetSupportedSchemes(void)
PropVariantClear(&value);
}
static void test_scheme_resolvers(void)
{
static const DWORD expect_caps = MFBYTESTREAM_IS_READABLE | MFBYTESTREAM_IS_SEEKABLE;
static const WCHAR *urls[] =
{
L"http://test.winehq.org/tests/test.mp3",
L"https://test.winehq.org/tests/test.mp3",
L"httpd://test.winehq.org/tests/test.mp3",
L"httpsd://test.winehq.org/tests/test.mp3",
L"mms://test.winehq.org/tests/test.mp3",
};
static const WCHAR *expect_domain[] =
{
L"http://test.winehq.org",
L"https://test.winehq.org",
L"http://test.winehq.org",
L"https://test.winehq.org",
L"http://test.winehq.org",
};
IMFSourceResolver *resolver;
IMFByteStream *byte_stream;
IMFAttributes *attributes;
PROPVARIANT propvar;
MF_OBJECT_TYPE type;
IUnknown *object;
UINT64 length;
DWORD i, caps;
HRESULT hr;
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
ok(hr == S_OK, "got hr %#lx\n", hr);
hr = MFCreateSourceResolver(&resolver);
ok(hr == S_OK, "got hr %#lx\n", hr);
for (i = 0; i < ARRAY_SIZE(urls); i++)
{
hr = IMFSourceResolver_CreateObjectFromURL(resolver, urls[i], MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == S_OK, "got hr %#lx\n", hr);
if (hr != S_OK)
continue;
hr = IUnknown_QueryInterface(object, &IID_IMFAttributes, (void **)&attributes);
ok(hr == S_OK, "got hr %#lx\n", hr);
hr = IMFAttributes_GetItem(attributes, &MF_BYTESTREAM_ORIGIN_NAME, NULL);
ok(hr == MF_E_ATTRIBUTENOTFOUND, "got hr %#lx\n", hr);
PropVariantInit(&propvar);
hr = IMFAttributes_GetItem(attributes, &MF_BYTESTREAM_EFFECTIVE_URL, &propvar);
ok(hr == S_OK || broken(hr == MF_E_ATTRIBUTENOTFOUND) /* Win7 */, "got hr %#lx\n", hr);
todo_wine
ok(!wcsncmp(expect_domain[i], propvar.pwszVal, wcslen(expect_domain[i]))
|| broken(hr == MF_E_ATTRIBUTENOTFOUND) /* Win7 */,
"got url %s\n", debugstr_w(propvar.pwszVal));
hr = PropVariantClear(&propvar);
ok(hr == S_OK, "got hr %#lx\n", hr);
hr = IMFAttributes_GetItem(attributes, &MF_BYTESTREAM_CONTENT_TYPE, NULL);
todo_wine
ok(hr == S_OK, "got hr %#lx\n", hr);
hr = IMFAttributes_GetItem(attributes, &MF_BYTESTREAM_LAST_MODIFIED_TIME, NULL);
todo_wine
ok(hr == S_OK, "got hr %#lx\n", hr);
IMFAttributes_Release(attributes);
hr = IUnknown_QueryInterface(object, &IID_IMFByteStream, (void **)&byte_stream);
ok(hr == S_OK, "got hr %#lx\n", hr);
hr = IMFByteStream_GetCapabilities(byte_stream, &caps);
ok(hr == S_OK, "got hr %#lx\n", hr);
todo_wine
ok(caps == (expect_caps | MFBYTESTREAM_IS_PARTIALLY_DOWNLOADED)
|| caps == (expect_caps | MFBYTESTREAM_DOES_NOT_USE_NETWORK),
"got caps %#lx\n", caps);
hr = IMFByteStream_GetLength(byte_stream, &length);
ok(hr == S_OK, "got hr %#lx\n", hr);
ok(length == 0x110d, "got length %#I64x\n", length);
IMFByteStream_Release(byte_stream);
IUnknown_Release(object);
}
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"httpt://test.winehq.org/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == MF_E_UNSUPPORTED_BYTESTREAM_TYPE, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"httpu://test.winehq.org/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == MF_E_UNSUPPORTED_BYTESTREAM_TYPE, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"http://test.winehq.bla/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == NS_E_SERVER_NOT_FOUND, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"https://test.winehq.bla/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == WININET_E_NAME_NOT_RESOLVED, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"httpd://test.winehq.bla/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == WININET_E_NAME_NOT_RESOLVED, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"httpsd://test.winehq.bla/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == WININET_E_NAME_NOT_RESOLVED, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"mms://test.winehq.bla/tests/test.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == WININET_E_NAME_NOT_RESOLVED, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"http://test.winehq.org/tests/invalid.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == NS_E_FILE_NOT_FOUND, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"https://test.winehq.org/tests/invalid.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == NS_E_FILE_NOT_FOUND, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"httpd://test.winehq.org/tests/invalid.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == NS_E_FILE_NOT_FOUND, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"httpsd://test.winehq.org/tests/invalid.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == NS_E_FILE_NOT_FOUND, "got hr %#lx\n", hr);
hr = IMFSourceResolver_CreateObjectFromURL(resolver, L"mms://test.winehq.org/tests/invalid.mp3", MF_RESOLUTION_BYTESTREAM, NULL, &type, &object);
todo_wine
ok(hr == MF_E_UNSUPPORTED_BYTESTREAM_TYPE, "got hr %#lx\n", hr);
IMFSourceResolver_Release(resolver);
hr = MFShutdown();
ok(hr == S_OK, "got hr %#lx\n", hr);
}
static void test_MFGetTopoNodeCurrentType(void)
{
static const struct attribute_desc media_type_desc[] =
......@@ -7098,6 +7227,7 @@ START_TEST(mf)
test_MFCreateSimpleTypeHandler();
test_MFGetSupportedMimeTypes();
test_MFGetSupportedSchemes();
test_scheme_resolvers();
test_MFGetTopoNodeCurrentType();
test_MFRequireProtectedEnvironment();
test_mpeg4_media_sink();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment