-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove deprecated MOCK_METHODx calls #45307
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4bdbda0
Impl
dkwingsmt 80d8bce
Fix compile
dkwingsmt a0f487d
convert all
dkwingsmt 1b8f82a
Fix compile
dkwingsmt 6c66db6
Fix more compile
dkwingsmt 8929fdb
Remove mocks
dkwingsmt a499744
Merge remote-tracking branch 'origin/main' into remove-deprecated_mock
dkwingsmt 1d338f9
Fix error
dkwingsmt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,111 +17,156 @@ namespace testing { | |
class MockDeviceBuffer : public DeviceBuffer { | ||
public: | ||
MockDeviceBuffer(const DeviceBufferDescriptor& desc) : DeviceBuffer(desc) {} | ||
MOCK_METHOD3(CopyHostBuffer, | ||
bool(const uint8_t* source, Range source_range, size_t offset)); | ||
// MOCK_METHOD(bool, CopyHostBuffer, (const uint8_t* source, Range | ||
// source_range, size_t offset), (override)); | ||
|
||
MOCK_METHOD1(SetLabel, bool(const std::string& label)); | ||
MOCK_METHOD(bool, SetLabel, (const std::string& label), (override)); | ||
|
||
MOCK_METHOD2(SetLabel, bool(const std::string& label, Range range)); | ||
MOCK_METHOD(bool, | ||
SetLabel, | ||
(const std::string& label, Range range), | ||
(override)); | ||
|
||
MOCK_CONST_METHOD0(OnGetContents, uint8_t*()); | ||
MOCK_METHOD(uint8_t*, OnGetContents, (), (const, override)); | ||
|
||
MOCK_METHOD3(OnCopyHostBuffer, | ||
bool(const uint8_t* source, Range source_range, size_t offset)); | ||
MOCK_METHOD(bool, | ||
OnCopyHostBuffer, | ||
(const uint8_t* source, Range source_range, size_t offset), | ||
(override)); | ||
}; | ||
|
||
class MockAllocator : public Allocator { | ||
public: | ||
MOCK_CONST_METHOD0(GetMaxTextureSizeSupported, ISize()); | ||
MOCK_METHOD1( | ||
OnCreateBuffer, | ||
std::shared_ptr<DeviceBuffer>(const DeviceBufferDescriptor& desc)); | ||
MOCK_METHOD1(OnCreateTexture, | ||
std::shared_ptr<Texture>(const TextureDescriptor& desc)); | ||
MOCK_METHOD(ISize, GetMaxTextureSizeSupported, (), (const, override)); | ||
MOCK_METHOD(std::shared_ptr<DeviceBuffer>, | ||
OnCreateBuffer, | ||
(const DeviceBufferDescriptor& desc), | ||
(override)); | ||
MOCK_METHOD(std::shared_ptr<Texture>, | ||
OnCreateTexture, | ||
(const TextureDescriptor& desc), | ||
(override)); | ||
}; | ||
|
||
class MockBlitPass : public BlitPass { | ||
public: | ||
MOCK_CONST_METHOD0(IsValid, bool()); | ||
MOCK_CONST_METHOD1( | ||
EncodeCommands, | ||
bool(const std::shared_ptr<Allocator>& transients_allocator)); | ||
MOCK_METHOD1(OnSetLabel, void(std::string label)); | ||
|
||
MOCK_METHOD5(OnCopyTextureToTextureCommand, | ||
bool(std::shared_ptr<Texture> source, | ||
std::shared_ptr<Texture> destination, | ||
IRect source_region, | ||
IPoint destination_origin, | ||
std::string label)); | ||
|
||
MOCK_METHOD5(OnCopyTextureToBufferCommand, | ||
bool(std::shared_ptr<Texture> source, | ||
std::shared_ptr<DeviceBuffer> destination, | ||
IRect source_region, | ||
size_t destination_offset, | ||
std::string label)); | ||
MOCK_METHOD4(OnCopyBufferToTextureCommand, | ||
bool(BufferView source, | ||
std::shared_ptr<Texture> destination, | ||
IPoint destination_origin, | ||
std::string label)); | ||
MOCK_METHOD2(OnGenerateMipmapCommand, | ||
bool(std::shared_ptr<Texture> texture, std::string label)); | ||
MOCK_METHOD(bool, IsValid, (), (const, override)); | ||
MOCK_METHOD(bool, | ||
EncodeCommands, | ||
(const std::shared_ptr<Allocator>& transients_allocator), | ||
(const, override)); | ||
MOCK_METHOD(void, OnSetLabel, (std::string label), (override)); | ||
|
||
MOCK_METHOD(bool, | ||
OnCopyTextureToTextureCommand, | ||
(std::shared_ptr<Texture> source, | ||
std::shared_ptr<Texture> destination, | ||
IRect source_region, | ||
IPoint destination_origin, | ||
std::string label), | ||
(override)); | ||
|
||
MOCK_METHOD(bool, | ||
OnCopyTextureToBufferCommand, | ||
(std::shared_ptr<Texture> source, | ||
std::shared_ptr<DeviceBuffer> destination, | ||
IRect source_region, | ||
size_t destination_offset, | ||
std::string label), | ||
(override)); | ||
MOCK_METHOD(bool, | ||
OnCopyBufferToTextureCommand, | ||
(BufferView source, | ||
std::shared_ptr<Texture> destination, | ||
IPoint destination_origin, | ||
std::string label), | ||
(override)); | ||
MOCK_METHOD(bool, | ||
OnGenerateMipmapCommand, | ||
(std::shared_ptr<Texture> texture, std::string label), | ||
(override)); | ||
}; | ||
|
||
class MockCommandBuffer : public CommandBuffer { | ||
public: | ||
MockCommandBuffer(std::weak_ptr<const Context> context) | ||
: CommandBuffer(context) {} | ||
MOCK_CONST_METHOD0(IsValid, bool()); | ||
MOCK_CONST_METHOD1(SetLabel, void(const std::string& label)); | ||
MOCK_METHOD0(OnCreateBlitPass, std::shared_ptr<BlitPass>()); | ||
MOCK_METHOD1(OnSubmitCommands, bool(CompletionCallback callback)); | ||
MOCK_METHOD0(OnWaitUntilScheduled, void()); | ||
MOCK_METHOD0(OnCreateComputePass, std::shared_ptr<ComputePass>()); | ||
MOCK_METHOD1(OnCreateRenderPass, | ||
std::shared_ptr<RenderPass>(RenderTarget render_target)); | ||
MOCK_METHOD(bool, IsValid, (), (const, override)); | ||
MOCK_METHOD(void, SetLabel, (const std::string& label), (const, override)); | ||
MOCK_METHOD(std::shared_ptr<BlitPass>, OnCreateBlitPass, (), (override)); | ||
MOCK_METHOD(bool, | ||
OnSubmitCommands, | ||
(CompletionCallback callback), | ||
(override)); | ||
MOCK_METHOD(void, OnWaitUntilScheduled, (), (override)); | ||
MOCK_METHOD(std::shared_ptr<ComputePass>, | ||
OnCreateComputePass, | ||
(), | ||
(override)); | ||
MOCK_METHOD(std::shared_ptr<RenderPass>, | ||
OnCreateRenderPass, | ||
(RenderTarget render_target), | ||
(override)); | ||
}; | ||
|
||
class MockImpellerContext : public Context { | ||
public: | ||
MOCK_CONST_METHOD0(GetBackendType, Context::BackendType()); | ||
MOCK_METHOD(Context::BackendType, GetBackendType, (), (const, override)); | ||
|
||
MOCK_CONST_METHOD0(DescribeGpuModel, std::string()); | ||
MOCK_METHOD(std::string, DescribeGpuModel, (), (const, override)); | ||
|
||
MOCK_CONST_METHOD0(IsValid, bool()); | ||
MOCK_METHOD(bool, IsValid, (), (const, override)); | ||
|
||
MOCK_METHOD0(Shutdown, void()); | ||
MOCK_METHOD(void, Shutdown, (), (override)); | ||
|
||
MOCK_CONST_METHOD0(GetResourceAllocator, std::shared_ptr<Allocator>()); | ||
MOCK_METHOD(std::shared_ptr<Allocator>, | ||
GetResourceAllocator, | ||
(), | ||
(const, override)); | ||
|
||
MOCK_CONST_METHOD0(GetShaderLibrary, std::shared_ptr<ShaderLibrary>()); | ||
MOCK_METHOD(std::shared_ptr<ShaderLibrary>, | ||
GetShaderLibrary, | ||
(), | ||
(const, override)); | ||
|
||
MOCK_CONST_METHOD0(GetSamplerLibrary, std::shared_ptr<SamplerLibrary>()); | ||
MOCK_METHOD(std::shared_ptr<SamplerLibrary>, | ||
GetSamplerLibrary, | ||
(), | ||
(const, override)); | ||
|
||
MOCK_CONST_METHOD0(GetPipelineLibrary, std::shared_ptr<PipelineLibrary>()); | ||
MOCK_METHOD(std::shared_ptr<PipelineLibrary>, | ||
GetPipelineLibrary, | ||
(), | ||
(const, override)); | ||
|
||
MOCK_CONST_METHOD0(CreateCommandBuffer, std::shared_ptr<CommandBuffer>()); | ||
MOCK_METHOD(std::shared_ptr<CommandBuffer>, | ||
CreateCommandBuffer, | ||
(), | ||
(const, override)); | ||
|
||
MOCK_CONST_METHOD0(GetCapabilities, | ||
const std::shared_ptr<const Capabilities>&()); | ||
MOCK_METHOD(const std::shared_ptr<const Capabilities>&, | ||
GetCapabilities, | ||
(), | ||
(const, override)); | ||
}; | ||
|
||
class MockTexture : public Texture { | ||
public: | ||
MockTexture(const TextureDescriptor& desc) : Texture(desc) {} | ||
MOCK_METHOD1(SetLabel, void(std::string_view label)); | ||
MOCK_METHOD3(SetContents, | ||
bool(const uint8_t* contents, size_t length, size_t slice)); | ||
MOCK_METHOD2(SetContents, | ||
bool(std::shared_ptr<const fml::Mapping> mapping, size_t slice)); | ||
MOCK_CONST_METHOD0(IsValid, bool()); | ||
MOCK_CONST_METHOD0(GetSize, ISize()); | ||
MOCK_METHOD3(OnSetContents, | ||
bool(const uint8_t* contents, size_t length, size_t slice)); | ||
MOCK_METHOD2(OnSetContents, | ||
bool(std::shared_ptr<const fml::Mapping> mapping, size_t slice)); | ||
MOCK_METHOD(void, SetLabel, (std::string_view label), (override)); | ||
// MOCK_METHOD(bool, SetContents, (const uint8_t* contents, size_t length, | ||
// size_t slice), (override)); MOCK_METHOD(bool, SetContents, | ||
// (std::shared_ptr<const fml::Mapping> mapping, size_t slice), (override)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this method is not virtual, and its mock is not used, this mock is removed. |
||
MOCK_METHOD(bool, IsValid, (), (const, override)); | ||
MOCK_METHOD(ISize, GetSize, (), (const, override)); | ||
MOCK_METHOD(bool, | ||
OnSetContents, | ||
(const uint8_t* contents, size_t length, size_t slice), | ||
(override)); | ||
MOCK_METHOD(bool, | ||
OnSetContents, | ||
(std::shared_ptr<const fml::Mapping> mapping, size_t slice), | ||
(override)); | ||
}; | ||
|
||
} // namespace testing | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this method is not virtual, and its mock is not used, this mock is removed.