Commit 6b7f4e18 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Convert D3D11 Mocks to use Microsoft::WRL::RuntimeClass Instead of IUnknownImpl

BUG=1014283

Change-Id: I819a1aa7bbc8dd29422cb5768571ff4735f79904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1859583
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Auto-Submit: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705773}
parent 9a5e7895
......@@ -11,7 +11,6 @@
#include <wrl/client.h>
#include <wrl/implements.h>
#include "base/win/iunknown_impl.h"
#include "media/base/win/d3d11_create_device_cb.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -80,7 +79,7 @@ ACTION_TEMPLATE(SetComPointeeAndReturnOk,
// Use this function to create a mock so that they are ref-counted correctly.
template <typename Interface>
Microsoft::WRL::ComPtr<Interface> CreateD3D11Mock() {
return new Interface();
return Microsoft::WRL::Make<Interface>();
}
// Class for mocking D3D11CreateDevice() function.
......@@ -92,20 +91,10 @@ class D3D11CreateDeviceMock {
};
template <class Interface>
class MockCOMInterface : public Interface, public base::win::IUnknownImpl {
public:
ULONG STDMETHODCALLTYPE AddRef() override { return IUnknownImpl::AddRef(); }
ULONG STDMETHODCALLTYPE Release() override { return IUnknownImpl::Release(); }
STDMETHODIMP QueryInterface(REFIID riid, void** ppv) override {
if (riid == __uuidof(Interface)) {
*ppv = static_cast<Interface*>(this);
AddRef();
return S_OK;
}
return IUnknownImpl::QueryInterface(riid, ppv);
}
class MockCOMInterface
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
Interface> {
protected:
~MockCOMInterface() override = default;
};
......
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