Commit 33081e58 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[unittests] Convert to the new MOCK_METHOD macro.

Change-Id: I3a624b9cb164dd4a49606f311f71ea0115afe30a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2238572
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68296}
parent 81e7c574
......@@ -55,8 +55,8 @@ static TestOperator kOpC1(kOpcodeC1, Operator::kNoWrite, "opc1", 1, 1);
static TestOperator kOpC2(kOpcodeC2, Operator::kNoWrite, "opc2", 2, 1);
struct MockReducer : public Reducer {
MOCK_CONST_METHOD0(reducer_name, const char*());
MOCK_METHOD1(Reduce, Reduction(Node*));
MOCK_METHOD(const char*, reducer_name, (), (const, override));
MOCK_METHOD(Reduction, Reduce, (Node*), (override));
};
......
......@@ -13,9 +13,9 @@ namespace internal {
namespace compiler {
struct MockAdvancedReducerEditor : public AdvancedReducer::Editor {
MOCK_METHOD1(Revisit, void(Node*));
MOCK_METHOD2(Replace, void(Node*, Node*));
MOCK_METHOD4(ReplaceWithValue, void(Node*, Node*, Node*, Node*));
MOCK_METHOD(void, Revisit, (Node*), (override));
MOCK_METHOD(void, Replace, (Node*, Node*), (override));
MOCK_METHOD(void, ReplaceWithValue, (Node*, Node*, Node*, Node*), (override));
};
} // namespace compiler
......
......@@ -17,22 +17,25 @@ namespace {
class MockGarbageCollector : public GarbageCollector {
public:
MOCK_METHOD1(CollectGarbage, void(GarbageCollector::Config));
MOCK_CONST_METHOD0(epoch, size_t());
MOCK_METHOD(void, CollectGarbage, (GarbageCollector::Config), (override));
MOCK_METHOD(size_t, epoch, (), (const, override));
};
class MockTaskRunner : public cppgc::TaskRunner {
public:
MOCK_METHOD1(PostTask, void(std::unique_ptr<cppgc::Task>));
MOCK_METHOD1(PostNonNestableTask, void(std::unique_ptr<cppgc::Task>));
MOCK_METHOD2(PostDelayedTask, void(std::unique_ptr<cppgc::Task>, double));
MOCK_METHOD2(PostNonNestableDelayedTask,
void(std::unique_ptr<cppgc::Task>, double));
MOCK_METHOD1(PostIdleTask, void(std::unique_ptr<cppgc::IdleTask>));
virtual bool IdleTasksEnabled() { return true; } // NOLINT
virtual bool NonNestableTasksEnabled() const { return true; } // NOLINT
virtual bool NonNestableDelayedTasksEnabled() const { // NOLINT
MOCK_METHOD(void, PostTask, (std::unique_ptr<cppgc::Task>), (override));
MOCK_METHOD(void, PostNonNestableTask, (std::unique_ptr<cppgc::Task>),
(override));
MOCK_METHOD(void, PostDelayedTask, (std::unique_ptr<cppgc::Task>, double),
(override));
MOCK_METHOD(void, PostNonNestableDelayedTask,
(std::unique_ptr<cppgc::Task>, double), (override));
MOCK_METHOD(void, PostIdleTask, (std::unique_ptr<cppgc::IdleTask>),
(override));
virtual bool IdleTasksEnabled() override { return true; } // NOLINT
bool NonNestableTasksEnabled() const override { return true; } // NOLINT
virtual bool NonNestableDelayedTasksEnabled() const override { // NOLINT
return true;
}
};
......
......@@ -39,8 +39,8 @@ class FakeGarbageCollector : public GarbageCollector {
class MockGarbageCollector : public GarbageCollector {
public:
MOCK_METHOD1(CollectGarbage, void(GarbageCollector::Config));
MOCK_CONST_METHOD0(epoch, size_t());
MOCK_METHOD(void, CollectGarbage, (GarbageCollector::Config), (override));
MOCK_METHOD(size_t, epoch, (), (const, override));
};
void FakeAllocate(StatsCollector* stats_collector, size_t bytes) {
......
......@@ -103,9 +103,9 @@ TEST_F(StatsCollectorTest, AllocatedObjectSizeAllocateAfterMarking) {
class MockAllocationObserver : public StatsCollector::AllocationObserver {
public:
MOCK_METHOD1(AllocatedObjectSizeIncreased, void(size_t));
MOCK_METHOD1(AllocatedObjectSizeDecreased, void(size_t));
MOCK_METHOD1(ResetAllocatedObjectSize, void(size_t));
MOCK_METHOD(void, AllocatedObjectSizeIncreased, (size_t), (override));
MOCK_METHOD(void, AllocatedObjectSizeDecreased, (size_t), (override));
MOCK_METHOD(void, ResetAllocatedObjectSize, (size_t), (override));
};
TEST_F(StatsCollectorTest, RegisterUnregisterObserver) {
......@@ -161,8 +161,8 @@ class AllocationObserverTriggeringGC final
}
// // Mock out the rest to trigger warnings if used.
MOCK_METHOD1(AllocatedObjectSizeDecreased, void(size_t));
MOCK_METHOD1(ResetAllocatedObjectSize, void(size_t));
MOCK_METHOD(void, AllocatedObjectSizeDecreased, (size_t), (override));
MOCK_METHOD(void, ResetAllocatedObjectSize, (size_t), (override));
size_t increase_call_count = 0;
size_t increased_size_bytes = 0;
......
......@@ -31,13 +31,16 @@ LocalEmbedderHeapTracer::WrapperInfo CreateWrapperInfo() {
class MockEmbedderHeapTracer : public EmbedderHeapTracer {
public:
MOCK_METHOD1(TracePrologue, void(EmbedderHeapTracer::TraceFlags));
MOCK_METHOD1(TraceEpilogue, void(EmbedderHeapTracer::TraceSummary*));
MOCK_METHOD1(EnterFinalPause, void(EmbedderStackState));
MOCK_METHOD0(IsTracingDone, bool());
MOCK_METHOD1(RegisterV8References,
void(const std::vector<std::pair<void*, void*> >&));
MOCK_METHOD1(AdvanceTracing, bool(double deadline_in_ms));
MOCK_METHOD(void, TracePrologue, (EmbedderHeapTracer::TraceFlags),
(override));
MOCK_METHOD(void, TraceEpilogue, (EmbedderHeapTracer::TraceSummary*),
(override));
MOCK_METHOD(void, EnterFinalPause, (EmbedderHeapTracer::EmbedderStackState),
(override));
MOCK_METHOD(bool, IsTracingDone, (), (override));
MOCK_METHOD(void, RegisterV8References,
((const std::vector<std::pair<void*, void*> >&)), (override));
MOCK_METHOD(bool, AdvanceTracing, (double deadline_in_ms), (override));
};
TEST(LocalEmbedderHeapTracer, InUse) {
......
......@@ -19,15 +19,15 @@ namespace {
struct MockTask : public Task {
// See issue v8:8185
~MockTask() /* override */ { Die(); }
MOCK_METHOD0(Run, void());
MOCK_METHOD0(Die, void());
MOCK_METHOD(void, Run, (), (override));
MOCK_METHOD(void, Die, ());
};
struct MockIdleTask : public IdleTask {
// See issue v8:8185
~MockIdleTask() /* override */ { Die(); }
MOCK_METHOD1(Run, void(double deadline_in_seconds));
MOCK_METHOD0(Die, void());
MOCK_METHOD(void, Run, (double deadline_in_seconds), (override));
MOCK_METHOD(void, Die, ());
};
class DefaultPlatformWithMockTime : public DefaultPlatform {
......@@ -225,7 +225,7 @@ class TestBackgroundTask : public Task {
: sem_(sem), executed_(executed) {}
~TestBackgroundTask() override { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD(void, Die, ());
void Run() override {
*executed_ = true;
......
......@@ -18,7 +18,7 @@ namespace task_queue_unittest {
namespace {
struct MockTask : public Task {
MOCK_METHOD0(Run, void());
MOCK_METHOD(void, Run, (), (override));
};
......
......@@ -19,8 +19,8 @@ namespace {
struct MockTask : public Task {
// See issue v8:8185
~MockTask() /* override */ { Die(); }
MOCK_METHOD0(Run, void());
MOCK_METHOD0(Die, void());
MOCK_METHOD(void, Run, (), (override));
MOCK_METHOD(void, Die, ());
};
} // namespace
......
......@@ -2054,11 +2054,11 @@ class ValueSerializerTestWithSharedArrayBufferClone
explicit SerializerDelegate(
ValueSerializerTestWithSharedArrayBufferClone* test)
: test_(test) {}
MOCK_METHOD2(GetSharedArrayBufferId,
Maybe<uint32_t>(Isolate* isolate,
Local<SharedArrayBuffer> shared_array_buffer));
MOCK_METHOD2(GetSharedArrayBufferFromId,
MaybeLocal<SharedArrayBuffer>(Isolate* isolate, uint32_t id));
MOCK_METHOD(Maybe<uint32_t>, GetSharedArrayBufferId,
(Isolate*, Local<SharedArrayBuffer> shared_array_buffer),
(override));
MOCK_METHOD(MaybeLocal<SharedArrayBuffer>, GetSharedArrayBufferFromId,
(Isolate*, uint32_t id));
void ThrowDataCloneError(Local<String> message) override {
test_->isolate()->ThrowException(Exception::Error(message));
}
......@@ -2071,8 +2071,8 @@ class ValueSerializerTestWithSharedArrayBufferClone
public:
explicit DeserializerDelegate(
ValueSerializerTestWithSharedArrayBufferClone* test) {}
MOCK_METHOD2(GetSharedArrayBufferFromId,
MaybeLocal<SharedArrayBuffer>(Isolate* isolate, uint32_t id));
MOCK_METHOD(MaybeLocal<SharedArrayBuffer>, GetSharedArrayBufferFromId,
(Isolate*, uint32_t id), (override));
};
#if __clang__
......@@ -2197,8 +2197,8 @@ class ValueSerializerTestWithHostObject : public ValueSerializerTest {
public:
explicit SerializerDelegate(ValueSerializerTestWithHostObject* test)
: test_(test) {}
MOCK_METHOD2(WriteHostObject,
Maybe<bool>(Isolate* isolate, Local<Object> object));
MOCK_METHOD(Maybe<bool>, WriteHostObject, (Isolate*, Local<Object> object),
(override));
void ThrowDataCloneError(Local<String> message) override {
test_->isolate()->ThrowException(Exception::Error(message));
}
......@@ -2209,7 +2209,7 @@ class ValueSerializerTestWithHostObject : public ValueSerializerTest {
class DeserializerDelegate : public ValueDeserializer::Delegate {
public:
MOCK_METHOD1(ReadHostObject, MaybeLocal<Object>(Isolate* isolate));
MOCK_METHOD(MaybeLocal<Object>, ReadHostObject, (Isolate*), (override));
};
#if __clang__
......@@ -2728,8 +2728,8 @@ class ValueSerializerTestWithLimitedMemory : public ValueSerializerTest {
test_->isolate()->ThrowException(Exception::Error(message));
}
MOCK_METHOD2(WriteHostObject,
Maybe<bool>(Isolate* isolate, Local<Object> object));
MOCK_METHOD(Maybe<bool>, WriteHostObject, (Isolate*, Local<Object> object),
(override));
private:
ValueSerializerTestWithLimitedMemory* test_;
......
......@@ -164,15 +164,15 @@ TEST_F(WasmGdbRemoteTest, GdbRemoteUtilStringSplit) {
class MockTransport : public TransportBase {
public:
MOCK_METHOD0(AcceptConnection, bool());
MOCK_METHOD2(Read, bool(char*, int32_t));
MOCK_METHOD2(Write, bool(const char*, int32_t));
MOCK_METHOD0(IsDataAvailable, bool());
MOCK_CONST_METHOD0(IsDataAvailable, bool());
MOCK_METHOD0(Disconnect, void());
MOCK_METHOD0(Close, void());
MOCK_METHOD0(WaitForDebugStubEvent, void());
MOCK_METHOD0(SignalThreadEvent, bool());
MOCK_METHOD(bool, AcceptConnection, (), (override));
MOCK_METHOD(bool, Read, (char*, int32_t), (override));
MOCK_METHOD(bool, Write, (const char*, int32_t), (override));
MOCK_METHOD(bool, IsDataAvailable, (), (override));
MOCK_METHOD(bool, IsDataAvailable, (), (const, override));
MOCK_METHOD(void, Disconnect, (), (override));
MOCK_METHOD(void, Close, (), (override));
MOCK_METHOD(void, WaitForDebugStubEvent, (), (override));
MOCK_METHOD(bool, SignalThreadEvent, (), (override));
};
TEST_F(WasmGdbRemoteTest, GdbRemoteSessionSendPacket) {
......
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