Commit a2573fcb authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

🤝 Update Disclosure model when notification is shown.

When the app is backgrounded and foregrounded again,
DisclosureNotification#onStartWithNative is called again, but
DisclosureController hasn't updated the model to reflect that the
notification has already been shown.

Change-Id: I96463c61e6e611528f47dd68f7c5a0cc4e34ec54
Bug: 1136477
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2467978Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816643}
parent d7db4a91
......@@ -73,6 +73,7 @@ public class TrustedWebActivityDisclosureController
@Override
public void onDisclosureShown() {
mBrowserServicesStore.setUserSeenTwaDisclosureForPackage(mClientPackageNameProvider.get());
mModel.set(DISCLOSURE_FIRST_TIME, false);
}
/** Shows the disclosure if it is not already showing and hasn't been accepted. */
......
......@@ -135,6 +135,16 @@ public class TrustedWebActivityDisclosureControllerTest {
assertFalse(mModel.get(DISCLOSURE_FIRST_TIME));
}
@Test
@Feature("TrustedWebActivities")
public void reportsFirstTime_reportsSeenImmediately() {
doReturn(false).when(mStore).hasUserSeenTwaDisclosureForPackage(anyString());
enterVerifiedOrigin();
assertTrue(mModel.get(DISCLOSURE_FIRST_TIME));
mModel.get(DISCLOSURE_EVENTS_CALLBACK).onDisclosureShown();
assertFalse(mModel.get(DISCLOSURE_FIRST_TIME));
}
@Test
@Feature("TrustedWebActivities")
public void recordsShown() {
......
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