-
Notifications
You must be signed in to change notification settings - Fork 862
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
Unit tests for virtual grants #4344
Conversation
vendor/bat-native-ledger/src/bat/ledger/internal/common/bind_util.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/common/bind_util.cc
Outdated
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/promotion/promotion.cc
Outdated
Show resolved
Hide resolved
// void OnTimer(const uint32_t timer_id); | ||
// Nb. Cannot test without mocking Promotion | ||
// discussed with tmancey and no value as code may be changing | ||
// need to confirm with nejc |
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.
@NejcZdovc Thoughts here?
vendor/bat-native-ledger/src/bat/ledger/internal/common/bind_util.cc
Outdated
Show resolved
Hide resolved
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.
LGTM
vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger.mojom
Show resolved
Hide resolved
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.
LGTM++
d70a661
to
c2783ae
Compare
CI is failing on unit tests https://ci.brave.com/job/brave-browser-build-pr/job/issues%252F6949/1/execution/node/591/log/ |
Most failing are unrelated, but these two;
failed and are related, but passed locally. The only failing tests I had locally were the YouTube related Media ones. I'll check it all out again, and rebase if needed. |
c2783ae
to
f750a4a
Compare
@@ -29,6 +29,14 @@ class MockLedgerClient : public ledger::LedgerClient { | |||
|
|||
void CreateWallet(ledger::LedgerCallbackHandler* handler) override; | |||
|
|||
MOCK_METHOD6(LoadURL, |
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.
why was this added here? we have ledger_client_mock.h
where we define mocks
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.
Ah, that's confusing naming then :D - but, this appear to be the 'mock' in use by the code, as this change resolved the failing tests (related to the discussion we had on zoom).
563b173
to
1601086
Compare
ledger::kStatePromotionCorruptedMigrated)) | ||
.WillByDefault(testing::Return(false)); | ||
|
||
EXPECT_CALL(*mock_ledger_impl_, GetAllPromotions(_)).Times(2); |
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.
@NejcZdovc promotion->Initialize()
invokes the GetAllPromotions
callback twice in this scenario, once to perform the CheckForCorrupted
and then it falls through to invoke Retry
... is this the expected behaviour? As it means CheckForCorrupted
is invoking an async LoadURL
, and then the code moves on to processing local data in Retry
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.
we could make it sync just for double safety
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.
@NejcZdovc do you want me to make that change as part of this PR? (I'd say it's a little out of scope tbh and is better as a new issue IMHO).
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.
- Ticket for GetAllPromotions rethink
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.
new issue is fine
Resolves brave/brave-browser#6949 - Bind Utils - Promotion - Promotion Utils - Security Helper (Ledger)
Resolves brave/brave-browser#6949
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Nb. I have two failing unit tests which are unrelated to my changes, and they seem to be failing on master - otherwise all unit tests pass - (888/890);
Reviewer Checklist:
After-merge Checklist:
changes has landed on.