Skip to content
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

Support GPP USNat v2 #3690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private static boolean checkKnownChildSensitiveDataConsents(USNatGppReader gppRe

return equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 0)
|| equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 1)
|| equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 2)
|| equalsAtIndex(KnownChildSensitiveDataConsent.CONSENT, knownChildSensitiveDataConsents, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private static boolean checkKnownChildSensitiveDataConsents(USNatGppReader gppRe

return equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 0)
|| equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 1)
|| equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 2)
|| equalsAtIndex(KnownChildSensitiveDataConsent.CONSENT, knownChildSensitiveDataConsents, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@

public class USNatTransmitUfpd implements PrivacyModule, Loggable {

private static final Set<Integer> SENSITIVE_DATA_INDICES_SET_1 = Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11);
private static final Set<Integer> SENSITIVE_DATA_INDICES_SET_2 = Set.of(0, 1, 2, 3, 4, 10);
private static final Set<Integer> SENSITIVE_DATA_INDICES_SET_3 = Set.of(5, 6, 8, 9, 11);
private static final Set<Integer> SENSITIVE_DATA_INDICES_SET_1 = Set.of(
0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15);
private static final Set<Integer> SENSITIVE_DATA_INDICES_SET_2 = Set.of(0, 1, 2, 3, 4, 10, 12, 14);
private static final Set<Integer> SENSITIVE_DATA_INDICES_SET_3 = Set.of(5, 6, 8, 9, 11, 13, 15);

private final USNatGppReader gppReader;
private final Result result;
Expand Down Expand Up @@ -124,6 +125,7 @@ private static boolean checkKnownChildSensitiveDataConsents(USNatGppReader gppRe

return equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 0)
|| equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 1)
|| equalsAtIndex(KnownChildSensitiveDataConsent.NO_CONSENT, knownChildSensitiveDataConsents, 2)
|| equalsAtIndex(KnownChildSensitiveDataConsent.CONSENT, knownChildSensitiveDataConsents, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,19 @@ public void proceedShouldDisallowIfKnownChildSensitiveDataConsents2Equals2() {
assertThat(result).isEqualTo(Rule.Result.DISALLOW);
}

@Test
public void proceedShouldDisallowIfKnownChildSensitiveDataConsents3Equals1() {
// given
given(gppReader.getKnownChildSensitiveDataConsents()).willReturn(asList(3, 3, 1));
final PrivacyModule target = new USNatSyncUser(gppReader);

// when
final Rule.Result result = target.proceed(null);

// then
assertThat(result).isEqualTo(Rule.Result.DISALLOW);
}

@Test
public void proceedShouldDisallowIfPersonalDataConsentsEquals2() {
// given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ public void proceedShouldDisallowIfKnownChildSensitiveDataConsents2Equals2() {
assertThat(result).isEqualTo(Rule.Result.DISALLOW);
}

@Test
public void proceedShouldDisallowIfKnownChildSensitiveDataConsents3Equals1() {
// given
given(gppReader.getKnownChildSensitiveDataConsents()).willReturn(asList(3, 3, 1));
final PrivacyModule target = new USNatTransmitGeo(gppReader);

// when
final Rule.Result result = target.proceed(null);

// then
assertThat(result).isEqualTo(Rule.Result.DISALLOW);
}

@Test
public void proceedShouldDisallowIfPersonalDataConsentsEquals2() {
// given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ public void proceedShouldDisallowIfSensitiveDataProcessingOptOutNoticeEquals2()

@Test
public void proceedShouldDisallowIfSensitiveDataProcessingOptOutNoticeEquals0AndOnCertainSensitiveDataProcessing() {
for (int i : Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11)) {
for (int i : Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15)) {
// given
given(gppReader.getSensitiveDataProcessingOptOutNotice()).willReturn(0);

final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
data.remove(i);
data.add(i, 2);
given(gppReader.getSensitiveDataProcessing()).willReturn(data);
Expand All @@ -230,11 +230,11 @@ public void proceedShouldDisallowIfSensitiveDataProcessingOptOutNoticeEquals0And

@Test
public void proceedShouldDisallowIfSensitiveDataLimitUseNoticeEquals0AndOnCertainSensitiveDataProcessing() {
for (int i : Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11)) {
for (int i : Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15)) {
// given
given(gppReader.getSensitiveDataLimitUseNotice()).willReturn(0);

final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
data.remove(i);
data.add(i, 2);
given(gppReader.getSensitiveDataProcessing()).willReturn(data);
Expand All @@ -251,9 +251,9 @@ public void proceedShouldDisallowIfSensitiveDataLimitUseNoticeEquals0AndOnCertai

@Test
public void proceedShouldDisallowIfSensitiveDataProcessingAtCertainIndicesEquals1() {
for (int i : Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11)) {
for (int i : Set.of(0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15)) {
// given
final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
data.remove(i);
data.add(i, 1);
given(gppReader.getSensitiveDataProcessing()).willReturn(data);
Expand All @@ -270,9 +270,9 @@ public void proceedShouldDisallowIfSensitiveDataProcessingAtCertainIndicesEquals

@Test
public void proceedShouldDisallowIfSensitiveDataProcessingAtCertainIndicesEquals2() {
for (int i : Set.of(5, 6, 8, 9, 11)) {
for (int i : Set.of(5, 6, 8, 9, 11, 13, 15)) {
// given
final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
final ArrayList<Integer> data = new ArrayList<>(asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
data.remove(i);
data.add(i, 2);
given(gppReader.getSensitiveDataProcessing()).willReturn(data);
Expand Down Expand Up @@ -313,6 +313,19 @@ public void proceedShouldDisallowIfKnownChildSensitiveDataConsents2NotEquals0()
assertThat(result).isEqualTo(Rule.Result.DISALLOW);
}

@Test
public void proceedShouldDisallowIfKnownChildSensitiveDataConsents3Equals1() {
// given
given(gppReader.getKnownChildSensitiveDataConsents()).willReturn(asList(3, 3, 1));
final PrivacyModule target = new USNatTransmitUfpd(gppReader);

// when
final Rule.Result result = target.proceed(null);

// then
assertThat(result).isEqualTo(Rule.Result.DISALLOW);
}

@Test
public void proceedShouldDisallowIfPersonalDataConsentsEquals2() {
// given
Expand Down
Loading