Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1699)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java

Issue 1847523002: Avoid HTML in WebRestrictionsContentProvider interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to one more comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
index 650b97f7e5e3712c59feccd1d4804cdcb343b044..df6e933cac699034bfba7c82ed9a00fc8d4d4399 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
@@ -14,8 +14,7 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import android.util.Pair;
-
+import org.chromium.components.webrestrictions.WebRestrictionsContentProvider.WebRestrictionsResult;
import org.chromium.testing.local.LocalRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
@@ -50,7 +49,7 @@ public class SupervisedUserContentProviderUnitTest {
public Void answer(InvocationOnMock invocation) throws Throwable {
Object args[] = invocation.getArguments();
((SupervisedUserContentProvider.SupervisedUserQueryReply) args[1])
- .onQueryComplete(true, null);
+ .onQueryComplete();
return null;
}
@@ -59,8 +58,8 @@ public class SupervisedUserContentProviderUnitTest {
.nativeShouldProceed(anyLong(),
any(SupervisedUserContentProvider.SupervisedUserQueryReply.class),
anyString());
- assertThat(mSupervisedUserContentProvider.shouldProceed("url"),
- is(new Pair<Boolean, String>(true, null)));
+ WebRestrictionsResult result = mSupervisedUserContentProvider.shouldProceed("url");
+ assertThat(result.shouldProceed(), is(true));
verify(mSupervisedUserContentProvider)
.nativeShouldProceed(eq(1234L),
any(SupervisedUserContentProvider.SupervisedUserQueryReply.class),
@@ -72,7 +71,8 @@ public class SupervisedUserContentProviderUnitTest {
public Void answer(InvocationOnMock invocation) throws Throwable {
Object args[] = invocation.getArguments();
((SupervisedUserContentProvider.SupervisedUserQueryReply) args[1])
- .onQueryComplete(false, "Hello");
+ .onQueryFailed(1, 2, 3, "url1", "url2", "custodian", "custodianEmail",
+ "secondCustodian", "secondCustodianEmail");
return null;
}
@@ -81,8 +81,19 @@ public class SupervisedUserContentProviderUnitTest {
.nativeShouldProceed(anyLong(),
any(SupervisedUserContentProvider.SupervisedUserQueryReply.class),
anyString());
- assertThat(mSupervisedUserContentProvider.shouldProceed("url"),
- is(new Pair<Boolean, String>(false, "Hello")));
+ result = mSupervisedUserContentProvider.shouldProceed("url");
+ assertThat(result.shouldProceed(), is(false));
+ assertThat(result.errorIntCount(), is(3));
+ assertThat(result.getErrorInt(0), is(1));
+ assertThat(result.getErrorInt(1), is(2));
+ assertThat(result.getErrorInt(2), is(3));
+ assertThat(result.errorStringCount(), is(6));
+ assertThat(result.getErrorString(0), is("url1"));
+ assertThat(result.getErrorString(1), is("url2"));
+ assertThat(result.getErrorString(2), is("custodian"));
+ assertThat(result.getErrorString(3), is("custodianEmail"));
+ assertThat(result.getErrorString(4), is("secondCustodian"));
+ assertThat(result.getErrorString(5), is("secondCustodianEmail"));
}
@Test

Powered by Google App Engine
This is Rietveld 408576698