Add a DeserializedEdge gmock matcher and use it in the gtests for DeserializedNode's ubi::node

RESOLVED FIXED in Firefox 45

Status

RESOLVED FIXED
4 years ago
6 months ago

People

(Reporter: fitzgen, Assigned: fitzgen)

Tracking

(Blocks: 2 bugs)

unspecified
Firefox 45
x86
Mac OS X
Dependency tree / graph

Firefox Tracking Flags

(firefox45 fixed)

Details

Attachments

(1 attachment)

(In reply to Jim Blandy :jimb from bug 1024774 comment #167)
> @@ +63,5 @@
> > +    edge1.referent = referent1->id;
> > +    mocked.addEdge(Move(edge1));
> > +    EXPECT_CALL(mocked,
> > +                getEdgeReferent(Field(&DeserializedEdge::referent,
> > +                                      referent1->id)))
> 
> For the future, it'd be nice to add a DeserializedEdge matcher to
> DevTools.h. Then we could just say exactly what we mean.
Assignee: nobody → nfitzgerald
Has STR: --- → irrelevant
Status: NEW → ASSIGNED
Created attachment 8683877 [details] [diff] [review]
Abstract out edge matching with a custom gmock matcher
Attachment #8683877 - Flags: review?(vporof)
Comment on attachment 8683877 [details] [diff] [review]
Abstract out edge matching with a custom gmock matcher

Review of attachment 8683877 [details] [diff] [review]:
-----------------------------------------------------------------

::: devtools/shared/heapsnapshot/tests/gtest/DeserializedNodeUbiNodes.cpp
@@ +64,5 @@
>                                                                     nullptr,
>                                                                     10));
>      DeserializedEdge edge1(referent1->id);
>      mocked.addEdge(Move(edge1));
> +    EXPECT_CALL(mocked, getEdgeReferent(EdgeTo(referent1->id)))

Whoa EXPECT_CALL is cool.

::: devtools/shared/heapsnapshot/tests/gtest/DevTools.h
@@ +280,5 @@
>  
> +// Matches an edge whose referent is the node with the given id.
> +MATCHER_P(EdgeTo, id, "") {
> +  return Matcher<const DeserializedEdge&>(Field(&DeserializedEdge::referent, id))
> +    .MatchAndExplain(arg, result_listener);

All of the code in here is gorgeous.
Attachment #8683877 - Flags: review?(vporof) → review+
Keywords: checkin-needed

Comment 5

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/55759fa6f9dc
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45

Updated

6 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.