Skip to content

Commit

Permalink
fix: remove unnecessary field from app.is_launching
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Apr 9, 2021
1 parent 37feef6 commit b814b1d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
1 change: 0 additions & 1 deletion bugsnag-plugin-android-ndk/src/main/jni/utils/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ typedef struct {
time_t duration_ms_offset;
time_t duration_in_foreground_ms_offset;
bool in_foreground;
bool is_launching;
char binary_arch[32];
} bsg_app_info_v2;

Expand Down
39 changes: 39 additions & 0 deletions bugsnag-plugin-android-ndk/src/test/cpp/test_utils_serialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,44 @@ TEST test_breadcrumbs_to_json(void) {
PASS();
}

void migrate_app_v2(bugsnag_report_v4 *report_v4, bugsnag_event *event);

TEST test_migrate_app_v2(void) {
bugsnag_report_v4 *report_v4 = malloc(sizeof(bugsnag_report_v4));
bugsnag_event *event = malloc(sizeof(bugsnag_event));
bsg_app_info_v2 *seed = &report_v4->app;
bsg_app_info *app = &event->app;

strcpy(seed->id, "id");
strcpy(seed->release_stage, "beta");
strcpy(seed->type, "c");
strcpy(seed->version, "1.5.2");
strcpy(seed->active_screen, "ExampleActivity");
strcpy(seed->build_uuid, "10f9");
strcpy(seed->binary_arch, "x86");
seed->version_code = 5;
seed->duration = 52;
seed->duration_in_foreground = 25;
seed->duration_ms_offset = 3;
seed->duration_in_foreground_ms_offset = 11;

// migrate pre-populated data
migrate_app_v2(report_v4, event);

ASSERT_STR_EQ("id", app->id);
ASSERT_STR_EQ("beta", app->release_stage);
ASSERT_STR_EQ("c", app->type);
ASSERT_STR_EQ("1.5.2", app->version);
ASSERT_STR_EQ("ExampleActivity", app->active_screen);
ASSERT_STR_EQ("10f9", app->build_uuid);
ASSERT_STR_EQ("x86", app->binary_arch);
ASSERT_FALSE(app->is_launching);

free(report_v4);
free(event);
PASS();
}

SUITE(serialize_utils) {
RUN_TEST(test_report_to_file);
RUN_TEST(test_last_run_info_serialization);
Expand All @@ -532,4 +570,5 @@ SUITE(serialize_utils) {
RUN_TEST(test_custom_info_to_json);
RUN_TEST(test_exception_to_json);
RUN_TEST(test_breadcrumbs_to_json);
RUN_TEST(test_migrate_app_v2);
}

0 comments on commit b814b1d

Please sign in to comment.