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

Unified Diff: components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java

Issue 2713513004: [Webview, Child Accounts] Always Google Play Services to show the reauthentication page. (Closed)
Patch Set: fix Created 3 years, 10 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: components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java
diff --git a/components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java b/components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java
index f381c04422cfbe820c84a1cca9acc93f32ede0a0..d2967a19d1c2cbe757dc953da86165f2a49ec9dc 100644
--- a/components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java
+++ b/components/web_restrictions/browser/junit/src/org/chromium/components/webrestrictions/browser/WebRestrictionsContentProviderTest.java
@@ -9,6 +9,7 @@ import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -18,16 +19,18 @@ import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.net.Uri;
-import org.chromium.components.webrestrictions.browser.WebRestrictionsContentProvider.WebRestrictionsResult;
-import org.chromium.testing.local.LocalRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowContentResolver;
+import org.chromium.components.webrestrictions.browser.WebRestrictionsContentProvider.WebRestrictionsResult;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+
/**
* Tests of WebRestrictionsContentProvider.
*/
@@ -46,7 +49,7 @@ public class WebRestrictionsContentProviderTest {
// necessary.
mContentProvider = Mockito.spy(new WebRestrictionsContentProvider() {
@Override
- protected WebRestrictionsResult shouldProceed(String url) {
+ protected WebRestrictionsResult shouldProceed(String callingPackage, String url) {
return null;
}
@@ -92,16 +95,18 @@ public class WebRestrictionsContentProviderTest {
int errorInt[] = {42};
String errorString[] = {"Error Message"};
WebRestrictionsResult result = new WebRestrictionsResult(false, errorInt, errorString);
- when(mContentProvider.shouldProceed(anyString())).thenReturn(result);
+ when(mContentProvider.shouldProceed(ArgumentMatchers.<String>isNull(), anyString()))
+ .thenReturn(result);
Cursor cursor = mContentResolver.query(mUri.buildUpon().appendPath("authorized").build(),
null, "url = 'dummy'", null, null);
- verify(mContentProvider).shouldProceed("dummy");
+ verify(mContentProvider).shouldProceed(ArgumentMatchers.<String>isNull(), eq("dummy"));
dgn 2017/02/23 12:19:49 doesn't `.shouldProceed(null, "dummy")` work here?
Bernhard Bauer 2017/02/23 16:36:21 Yes, if I don't use eq() for the second argument.
assertThat(cursor, is(not(nullValue())));
assertThat(cursor.getInt(0), is(WebRestrictionsContentProvider.BLOCKED));
assertThat(cursor.getInt(1), is(42));
assertThat(cursor.getString(2), is("Error Message"));
result = new WebRestrictionsResult(true, null, null);
- when(mContentProvider.shouldProceed(anyString())).thenReturn(result);
+ when(mContentProvider.shouldProceed(ArgumentMatchers.<String>isNull(), anyString()))
+ .thenReturn(result);
cursor = mContentResolver.query(mUri.buildUpon().appendPath("authorized").build(), null,
"url = 'dummy'", null, null);
assertThat(cursor, is(not(nullValue())));

Powered by Google App Engine
This is Rietveld 408576698