-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1308 from microsoft/develop
Version 2.5.0
- Loading branch information
Showing
33 changed files
with
1,451 additions
and
930 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for the Android SDK for App Center | ||
title: '' | ||
labels: feature request | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
apps/sasquatch/src/main/java/com/microsoft/appcenter/sasquatch/CrashTestHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
package com.microsoft.appcenter.sasquatch; | ||
|
||
import android.app.Activity; | ||
|
||
import com.microsoft.appcenter.crashes.Crashes; | ||
import com.microsoft.appcenter.crashes.model.TestCrashException; | ||
|
||
import java.io.IOException; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Random; | ||
|
||
public class CrashTestHelper { | ||
|
||
private final List<Crash> mCrashes = Arrays.asList( | ||
new Crash(R.string.title_test_crash, R.string.description_test_crash, new Runnable() { | ||
|
||
@Override | ||
public void run() { | ||
Crashes.generateTestCrash(); | ||
throw new TestCrashException(); | ||
} | ||
}), | ||
new Crash(R.string.title_crash_divide_by_0, R.string.description_crash_divide_by_0, new Runnable() { | ||
|
||
@Override | ||
@SuppressWarnings("ResultOfMethodCallIgnored") | ||
public void run() { | ||
("" + (42 / Integer.valueOf("0"))).toCharArray(); | ||
} | ||
}), | ||
new Crash(R.string.title_stack_overflow_crash, R.string.description_stack_overflow_crash, new Runnable() { | ||
|
||
@Override | ||
@SuppressWarnings("InfiniteRecursion") | ||
public void run() { | ||
run(); | ||
} | ||
}), | ||
new Crash(R.string.title_nested_exception_crash, R.string.description_nested_exception_crash, new Runnable() { | ||
|
||
@Override | ||
public void run() { | ||
throw new RuntimeException("HTTP call failed", new IOException("Broken pipe")); | ||
} | ||
}), | ||
new Crash(R.string.title_deeply_nested_exception_crash, R.string.description_deeply_nested_exception_crash, new Runnable() { | ||
|
||
@Override | ||
public void run() { | ||
Exception e = new Exception(); | ||
for (int i = 0; i < 1000; i++) { | ||
e = new Exception(String.valueOf(i), e); | ||
} | ||
throw new RuntimeException(e); | ||
} | ||
}), | ||
new Crash(R.string.title_memory_crash, R.string.description_memory_crash, new Runnable() { | ||
|
||
@Override | ||
public void run() { | ||
new int[Integer.MAX_VALUE].clone(); | ||
} | ||
}), | ||
new Crash(R.string.title_variable_message, R.string.description_variable_message, new Runnable() { | ||
|
||
@Override | ||
public void run() { | ||
mActivity.getResources().openRawResource(~new Random().nextInt(10)); | ||
} | ||
}) | ||
); | ||
|
||
private Activity mActivity; | ||
|
||
public CrashTestHelper(Activity activity) { | ||
mActivity = activity; | ||
} | ||
|
||
public List<Crash> getCrashes() { | ||
return mCrashes; | ||
} | ||
|
||
public static class Crash { | ||
|
||
public final int title; | ||
|
||
public final int description; | ||
|
||
public final Runnable crashTask; | ||
|
||
public Crash(int title, int description, Runnable crashTask) { | ||
this.title = title; | ||
this.description = description; | ||
this.crashTask = crashTask; | ||
} | ||
} | ||
} |
Oops, something went wrong.