OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview.test.crash; | 5 package org.chromium.android_webview.test.crash; |
6 | 6 |
7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
8 | 8 |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.os.ParcelFileDescriptor; | 10 import android.os.ParcelFileDescriptor; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 /** | 120 /** |
121 * Test to ensure the minidump uploading mechanism behaves as expected when
we fail to upload | 121 * Test to ensure the minidump uploading mechanism behaves as expected when
we fail to upload |
122 * minidumps. | 122 * minidumps. |
123 */ | 123 */ |
124 @MediumTest | 124 @MediumTest |
125 public void testFailUploadingMinidumps() throws IOException { | 125 public void testFailUploadingMinidumps() throws IOException { |
126 final CrashReportingPermissionManager permManager = | 126 final CrashReportingPermissionManager permManager = |
127 new MockCrashReportingPermissionManager() { | 127 new MockCrashReportingPermissionManager() { |
128 { | 128 { |
129 mIsInSample = true; | 129 mIsInSample = true; |
130 mIsPermitted = true; | |
131 mIsUserPermitted = true; | 130 mIsUserPermitted = true; |
132 mIsCommandLineDisabled = false; | 131 mIsCommandLineDisabled = false; |
133 mIsNetworkAvailable = false; // Will cause us to fail up
loads | 132 mIsNetworkAvailable = false; // Will cause us to fail up
loads |
134 mIsEnabledForTests = false; | 133 mIsEnabledForTests = false; |
135 } | 134 } |
136 }; | 135 }; |
137 MinidumpUploaderDelegate delegate = new TestMinidumpUploaderDelegate( | 136 MinidumpUploaderDelegate delegate = new TestMinidumpUploaderDelegate( |
138 getInstrumentation().getTargetContext(), permManager); | 137 getInstrumentation().getTargetContext(), permManager); |
139 MinidumpUploader minidumpUploader = new TestMinidumpUploaderImpl(delegat
e, permManager); | 138 MinidumpUploader minidumpUploader = new TestMinidumpUploaderImpl(delegat
e, permManager); |
140 | 139 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 505 } |
507 @Override | 506 @Override |
508 public CrashReportingPermissionManager createCrashReportingPermissionMan
ager() { | 507 public CrashReportingPermissionManager createCrashReportingPermissionMan
ager() { |
509 final CrashReportingPermissionManager realPermissionManager = | 508 final CrashReportingPermissionManager realPermissionManager = |
510 super.createCrashReportingPermissionManager(); | 509 super.createCrashReportingPermissionManager(); |
511 return new MockCrashReportingPermissionManager() { | 510 return new MockCrashReportingPermissionManager() { |
512 { | 511 { |
513 // This setup ensures we depend on | 512 // This setup ensures we depend on |
514 // isUsageAndCrashReportingPermittedByUser(). | 513 // isUsageAndCrashReportingPermittedByUser(). |
515 mIsInSample = true; | 514 mIsInSample = true; |
516 mIsPermitted = true; | |
517 mIsCommandLineDisabled = false; | 515 mIsCommandLineDisabled = false; |
518 mIsNetworkAvailable = true; | 516 mIsNetworkAvailable = true; |
519 mIsEnabledForTests = false; | 517 mIsEnabledForTests = false; |
520 } | 518 } |
521 @Override | 519 @Override |
522 public boolean isUsageAndCrashReportingPermittedByUser() { | 520 public boolean isUsageAndCrashReportingPermittedByUser() { |
523 // Ensure that we use the real implementation of | 521 // Ensure that we use the real implementation of |
524 // isUsageAndCrashReportingPermittedByUser. | 522 // isUsageAndCrashReportingPermittedByUser. |
525 boolean userPermitted = | 523 boolean userPermitted = |
526 realPermissionManager.isUsageAndCrashReportingPermit
tedByUser(); | 524 realPermissionManager.isUsageAndCrashReportingPermit
tedByUser(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 assertEquals(numMinidumps, uploadedFiles.length); | 688 assertEquals(numMinidumps, uploadedFiles.length); |
691 return uploadedFiles; | 689 return uploadedFiles; |
692 } | 690 } |
693 | 691 |
694 private File createMinidumpFileInCrashDir(String name) throws IOException { | 692 private File createMinidumpFileInCrashDir(String name) throws IOException { |
695 File minidumpFile = new File(mCrashDir, name); | 693 File minidumpFile = new File(mCrashDir, name); |
696 setUpMinidumpFile(minidumpFile, BOUNDARY); | 694 setUpMinidumpFile(minidumpFile, BOUNDARY); |
697 return minidumpFile; | 695 return minidumpFile; |
698 } | 696 } |
699 } | 697 } |
OLD | NEW |