-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
187 additions
and
28 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
34 changes: 34 additions & 0 deletions
34
...unner/src/main/java/com/bugsnag/android/mazerunner/scenarios/CXXStartSessionScenario.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,34 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import android.content.Context; | ||
|
||
import com.bugsnag.android.Bugsnag; | ||
import com.bugsnag.android.Configuration; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CXXStartSessionScenario extends Scenario { | ||
static { | ||
System.loadLibrary("bugsnag-ndk"); | ||
System.loadLibrary("monochrome"); | ||
System.loadLibrary("entrypoint"); | ||
} | ||
|
||
public native int crash(int counter); | ||
|
||
public CXXStartSessionScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
String metadata = getEventMetaData(); | ||
|
||
if (metadata == null || !metadata.equals("non-crashy")) { | ||
Bugsnag.getClient().startSession(); | ||
crash(0); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...runner/src/main/java/com/bugsnag/android/mazerunner/scenarios/CXXStopSessionScenario.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,35 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import android.content.Context; | ||
|
||
import com.bugsnag.android.Bugsnag; | ||
import com.bugsnag.android.Configuration; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CXXStopSessionScenario extends Scenario { | ||
static { | ||
System.loadLibrary("bugsnag-ndk"); | ||
System.loadLibrary("monochrome"); | ||
System.loadLibrary("entrypoint"); | ||
} | ||
|
||
public native int crash(int counter); | ||
|
||
public CXXStopSessionScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
String metadata = getEventMetaData(); | ||
|
||
if (metadata == null || !metadata.equals("non-crashy")) { | ||
Bugsnag.getClient().startSession(); | ||
Bugsnag.getClient().stopSession(); | ||
crash(0); | ||
} | ||
} | ||
} |
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,19 @@ | ||
Feature: NDK Session Tracking | ||
|
||
Scenario: Started session is in payload of unhandled NDK error | ||
When I run "CXXStartSessionScenario" | ||
And I configure the app to run in the "non-crashy" state | ||
And I relaunch the app | ||
Then I should receive 2 requests | ||
And the request 0 is a valid for the session tracking API | ||
And the request 1 is a valid for the error reporting API | ||
And the payload field "events.0.session.events.unhandled" equals 1 for request 1 | ||
|
||
Scenario: Stopped session is not in payload of unhandled NDK error | ||
When I run "CXXStopSessionScenario" | ||
And I configure the app to run in the "non-crashy" state | ||
And I relaunch the app | ||
Then I should receive 2 requests | ||
And the request 0 is a valid for the session tracking API | ||
And the request 1 is a valid for the error reporting API | ||
And the payload field "events.0.session" is null for request 1 |
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
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
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
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
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