Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadCallableTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadCallableTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadCallableTest.java |
| index 8bfcb301d688aa3677869e79d3a15ee731a70120..8654e38decdaac8765837881d155fe08efe6b70d 100644 |
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadCallableTest.java |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadCallableTest.java |
| @@ -113,14 +113,17 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| private static class MockCrashReportingPermissionManager |
| implements CrashReportingPermissionManager { |
| + private final boolean mIsInSample; |
| private final boolean mIsPermitted; |
| private final boolean mIsUserPermitted; |
| private final boolean mIsCommandLineDisabled; |
| private final boolean mIsLimited; |
| private final boolean mIsEnabledForTests; |
| - MockCrashReportingPermissionManager(boolean isPermitted, boolean isUserPermitted, |
| - boolean isCommandLineDisabled, boolean isLimited, boolean isEnabledForTests) { |
| + MockCrashReportingPermissionManager(boolean isInSample, boolean isPermitted, |
| + boolean isUserPermitted, boolean isCommandLineDisabled, boolean isLimited, |
| + boolean isEnabledForTests) { |
| + mIsInSample = isInSample; |
|
Alexei Svitkine (slow)
2016/08/18 06:16:39
Sigh, I really hate this mock class, as it makes i
jwd
2016/08/23 18:40:03
Done.
|
| mIsPermitted = isPermitted; |
| mIsUserPermitted = isUserPermitted; |
| mIsCommandLineDisabled = isCommandLineDisabled; |
| @@ -129,6 +132,11 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| } |
| @Override |
| + public boolean isClientInMetricsSample() { |
| + return mIsInSample; |
| + } |
| + |
| + @Override |
| public boolean isUploadPermitted() { |
| return mIsPermitted; |
| } |
| @@ -200,7 +208,7 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| @Feature({"Android-AppBase"}) |
| public void testCallWhenCurrentlyPermitted() throws Exception { |
| CrashReportingPermissionManager testPermManager = |
| - new MockCrashReportingPermissionManager(true, true, false, false, false); |
| + new MockCrashReportingPermissionManager(true, true, true, false, false, false); |
| HttpURLConnectionFactory httpURLConnectionFactory = new TestHttpURLConnectionFactory(); |
| @@ -216,7 +224,7 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| @Feature({"Android-AppBase"}) |
| public void testCallNotPermittedByUser() throws Exception { |
| CrashReportingPermissionManager testPermManager = |
| - new MockCrashReportingPermissionManager(false, false, false, false, false); |
| + new MockCrashReportingPermissionManager(true, false, false, false, false, false); |
| HttpURLConnectionFactory httpURLConnectionFactory = new FailHttpURLConnectionFactory(); |
| @@ -231,7 +239,7 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| @Feature({"Android-AppBase"}) |
| public void testCallNotPermittedByCommandLine() throws Exception { |
| CrashReportingPermissionManager testPermManager = |
| - new MockCrashReportingPermissionManager(true, true, true, false, false); |
| + new MockCrashReportingPermissionManager(true, true, true, true, false, false); |
| HttpURLConnectionFactory httpURLConnectionFactory = new FailHttpURLConnectionFactory(); |
| @@ -244,9 +252,24 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| @SmallTest |
| @Feature({"Android-AppBase"}) |
| + public void testCallPermittedButNotInSample() throws Exception { |
| + CrashReportingPermissionManager testPermManager = |
| + new MockCrashReportingPermissionManager(false, true, true, false, false, false); |
| + |
| + HttpURLConnectionFactory httpURLConnectionFactory = new TestHttpURLConnectionFactory(); |
| + |
| + MinidumpUploadCallable minidumpUploadCallable = |
| + new MockMinidumpUploadCallable(httpURLConnectionFactory, testPermManager); |
| + assertEquals( |
| + MinidumpUploadCallable.UPLOAD_FAILURE, minidumpUploadCallable.call().intValue()); |
| + assertFalse(mExpectedFileAfterUpload.exists()); |
| + } |
| + |
| + @SmallTest |
| + @Feature({"Android-AppBase"}) |
| public void testCallPermittedButNotUnderCurrentCircumstances() throws Exception { |
| CrashReportingPermissionManager testPermManager = |
| - new MockCrashReportingPermissionManager(false, true, false, false, false); |
| + new MockCrashReportingPermissionManager(true, false, true, false, false, false); |
| HttpURLConnectionFactory httpURLConnectionFactory = new FailHttpURLConnectionFactory(); |
| @@ -261,7 +284,7 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| @Feature({"Android-AppBase"}) |
| public void testCrashUploadConstrainted() throws Exception { |
| CrashReportingPermissionManager testPermManager = |
| - new MockCrashReportingPermissionManager(true, true, false, true, false); |
| + new MockCrashReportingPermissionManager(true, true, true, false, true, false); |
| HttpURLConnectionFactory httpURLConnectionFactory = new TestHttpURLConnectionFactory(); |
| @@ -276,7 +299,7 @@ public class MinidumpUploadCallableTest extends CrashTestCase { |
| @Feature({"Android-AppBase"}) |
| public void testCrashUploadEnabledForTestsDespiteConstraints() throws Exception { |
| CrashReportingPermissionManager testPermManager = |
| - new MockCrashReportingPermissionManager(false, false, false, true, true); |
| + new MockCrashReportingPermissionManager(true, false, false, false, true, true); |
| HttpURLConnectionFactory httpURLConnectionFactory = new TestHttpURLConnectionFactory(); |