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

Unified Diff: net/android/junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java

Issue 1508833003: Fix permission checking for negotiate auth on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the dependent patchset Created 4 years, 11 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: net/android/junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java
diff --git a/net/android/junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java b/net/android/junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java
index b0d76c47ec9e18cc3246616579709b67055ea66f..de211a1e36ae588395a188d750c4bb47c7aa8ae6 100644
--- a/net/android/junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java
+++ b/net/android/junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java
@@ -10,6 +10,7 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
@@ -195,7 +196,7 @@ public void testGetAccountCallback() {
callback.run(makeFuture(new Account[]{}));
verify(authenticator).nativeSetResult(
eq(42L),
- eq(NetError.ERR_INVALID_AUTH_CREDENTIALS),
+ eq(NetError.ERR_MISSING_AUTH_CREDENTIALS),
isNull(String.class));
// Should succeed, for a single account we use it for the AccountManager#getAuthToken call.
@@ -213,7 +214,7 @@ public void testGetAccountCallback() {
callback.run(makeFuture(new Account[]{new Account("a", type), new Account("b", type)}));
verify(authenticator, times(2)).nativeSetResult(
eq(42L),
- eq(NetError.ERR_INVALID_AUTH_CREDENTIALS),
+ eq(NetError.ERR_MISSING_AUTH_CREDENTIALS),
isNull(String.class));
}
@@ -303,7 +304,8 @@ public void testPermissionDenied() {
Robolectric.buildActivity(Activity.class).create().start().resume().visible();
HttpNegotiateAuthenticator authenticator = createWithoutNative("Dummy_Account");
- doReturn(false).when(authenticator).hasPermission(any(Context.class), anyString());
+ doReturn(true).when(authenticator)
+ .lacksPermission(any(Context.class), anyString(), anyBoolean());
authenticator.getNextAuthToken(1234, "test_principal", "", true);
verify(authenticator)
@@ -452,7 +454,9 @@ private HttpNegotiateAuthenticator createWithoutNative(String accountType) {
HttpNegotiateAuthenticator authenticator =
spy(HttpNegotiateAuthenticator.create(accountType));
doNothing().when(authenticator).nativeSetResult(anyLong(), anyInt(), anyString());
- doReturn(true).when(authenticator).hasPermission(any(Context.class), anyString());
+ doReturn(false)
+ .when(authenticator)
+ .lacksPermission(any(Context.class), anyString(), anyBoolean());
return authenticator;
}
}

Powered by Google App Engine
This is Rietveld 408576698