Skip to content

Commit

Permalink
Merge c1cd182 into 6181d68
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Feb 26, 2019
2 parents 6181d68 + c1cd182 commit baa67dd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
@@ -1,6 +1,7 @@
package com.bugsnag.android.mazerunner.scenarios;

import android.content.Context;
import android.os.Handler;

import com.bugsnag.android.Bugsnag;
import com.bugsnag.android.Configuration;
Expand All @@ -14,6 +15,8 @@ public class CXXStartSessionScenario extends Scenario {
System.loadLibrary("entrypoint");
}

private Handler handler = new Handler();

public native int crash(int counter);

public CXXStartSessionScenario(@NonNull Configuration config, @NonNull Context context) {
Expand All @@ -28,7 +31,13 @@ public void run() {

if (metadata == null || !metadata.equals("non-crashy")) {
Bugsnag.getClient().startSession();
crash(0);

handler.postDelayed(new Runnable() {
@Override
public void run() {
crash(0);
}
}, 8000);
}
}
}
@@ -1,6 +1,7 @@
package com.bugsnag.android.mazerunner.scenarios;

import android.content.Context;
import android.os.Handler;

import com.bugsnag.android.Bugsnag;
import com.bugsnag.android.Configuration;
Expand All @@ -14,6 +15,8 @@ public class CXXStopSessionScenario extends Scenario {
System.loadLibrary("entrypoint");
}

private Handler handler = new Handler();

public native int crash(int counter);

public CXXStopSessionScenario(@NonNull Configuration config, @NonNull Context context) {
Expand All @@ -29,7 +32,13 @@ public void run() {
if (metadata == null || !metadata.equals("non-crashy")) {
Bugsnag.getClient().startSession();
Bugsnag.getClient().stopSession();
crash(0);

handler.postDelayed(new Runnable() {
@Override
public void run() {
crash(0);
}
}, 8000);
}
}
}
4 changes: 4 additions & 0 deletions features/native_session_tracking.feature
Expand Up @@ -2,6 +2,8 @@ Feature: NDK Session Tracking

Scenario: Stopped session is not in payload of unhandled NDK error
When I run "CXXStopSessionScenario"
And I wait a bit
And I wait a bit
And I configure the app to run in the "non-crashy" state
And I relaunch the app
Then I should receive 2 requests
Expand All @@ -11,6 +13,8 @@ Scenario: Stopped session is not in payload of unhandled NDK error

Scenario: Started session is in payload of unhandled NDK error
When I run "CXXStartSessionScenario"
And I wait a bit
And I wait a bit
And I configure the app to run in the "non-crashy" state
And I relaunch the app
Then I should receive 2 requests
Expand Down

0 comments on commit baa67dd

Please sign in to comment.