-
Notifications
You must be signed in to change notification settings - Fork 889
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
Add support for P3A wallet state (Q11) #8641
Conversation
3f892b7
to
4a0a484
Compare
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.
I think the namespace really helps with readability here.
} else { | ||
p3a::RecordWalletState({.wallet_created = true, | ||
.rewards_enabled = true, | ||
.grants_claimed = false, |
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.
Nit: it looks like these two branches can be combined now, if you want, with:
.grants_claimed = pref_service->GetBoolean(prefs::kUserHasClaimedGrant),
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 yeah, will do.
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
4a0a484
to
8ec53bf
Compare
can we add browsertests for these metrics? I'm afraid that they are quite fragile and can be damaged by any refactoring. Histograms can be tested using |
8ec53bf
to
0922a71
Compare
two small things: (1) pls don't forget to update the p3a wiki page (2) it maybe worth adding some steps that restart the browser to the test plan |
d17e10f
to
b1f1904
Compare
CI passed on iOS, Windows. Failed on |
b1f1904
to
2d95b4d
Compare
Linux CI passed; ready to merge. |
Updated https://github.com/brave/brave-browser/wiki/P3A#q11-what-is-the-state-of-your-brave-rewards-wallet - can you take a look @emerick to verify it looks correct? I wasn't sure if this worked on Android or not so I left a question mark there |
@bsclifton Ah thank you, yes I'll check that out today! |
run_loop.Run(); | ||
} | ||
|
||
void WaitForRewardsInitialization() { |
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.
I'm having a hard time understanding how this waits for rewards initialization. It just checks once and then runs an empty RunLoop which will just finish immediately. I'm seeing failures when running this in Debug mode and I believe it's because there is a race condition here and we're not actually waiting for rewards to be initialized
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.
@brave/rewards-client
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.
I think this is doing the right thing in this specific case, but I wouldn't doubt that there may be some other issues in this test (or the Rewards tests in general). But I think the call to Run
here will block until the OnRewardsInitialized
observer fires and calls Quit
on this run loop. What may have caused confusion is that this PR did not include that call to Quit
; that mistake was caught in a follow-up PR. We could clean this up to use the nicer Watcher
paradigm from upstream, which would also help to clarify the intent. Apologies though if I'm missing a deeper problem.
Resolves brave/brave-browser#7634
Resolves brave/brave-browser#13996
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Grants test
Brave.Rewards.WalletState
is set to0
in brave://local-stateBrave.Rewards.WalletState
is set to1
in brave://local-stateBrave.Rewards.WalletState
is set to2
in brave://local-stateBrave.Rewards.WalletState
is set to5
in brave://local-stateFunds test
Brave.Rewards.WalletState
is set to0
in brave://local-stateBrave.Rewards.WalletState
is set to1
in brave://local-stateBrave.Rewards.WalletState
is set to3
in brave://local-stateBrave.Rewards.WalletState
is set to4
in brave://local-stateBrave.Rewards.WalletState
is set to5
in brave://local-state