bool switch_user_subsession(const int session_uid, const std::string_view prev_subsession, const std::string_view next_subsession)
{
+ if (prev_subsession == next_subsession)
+ return true;
+
/* We switch into next first, and only then switch away from prev. This is so
* that we are never in an intermediate "no session" state which is important
* for robustness (consider the case where Away succeeds and Into fails). */
// Test
-const int action_items = 29;
+const int action_items = 31;
TEST(subsession_switch_user_test, APISwitchUserTest) {
.cb_expected = SUBSESSION_ERROR_INVALID_PARAMETER,
.cb_desc = "Check if getting current user [" + std::string(TestUserStr::user_5) + " ] is done", },
+ // Fixed size -> self
+ api_call_res_t{ .call_result = std::move(subsession_switch_user_l<subsession_5001>( TestUserStr::user_5)),
+ .expected = SUBSESSION_ERROR_NONE,
+ .desc = "Check if switch to [ " + std::string(TestUserStr::user_5) + " ] is successful",
+ .cb_expected = SUBSESSION_ERROR_NONE,
+ .cb_desc = "Check if switch to [" + std::string(TestUserStr::user_5) + " ] callback is successful", },
+
// Fixed size -> regular dir
api_call_res_t{ .call_result = std::move(subsession_switch_user_l<subsession_5001>( TestUserStr::user_1)),
.expected = SUBSESSION_ERROR_NONE,
.cb_expected = SUBSESSION_ERROR_INVALID_PARAMETER,
.cb_desc = "Check if getting current user [" + std::string(TestUserStr::user_1) + " ] is done", },
+ // Regular dir -> self
+ api_call_res_t{ .call_result = std::move(subsession_switch_user_l<subsession_5001>( TestUserStr::user_1)),
+ .expected = SUBSESSION_ERROR_NONE,
+ .desc = "Check if switch to [ " + std::string(TestUserStr::user_1) + " ] is successful",
+ .cb_expected = SUBSESSION_ERROR_NONE,
+ .cb_desc = "Check if switch to [" + std::string(TestUserStr::user_1) + " ] callback is successful", },
+
+
// Regular dir -> default
api_call_res_t{ .call_result = std::move(subsession_switch_user_l<subsession_5001>( TestUserStr::user_0)),
.expected = SUBSESSION_ERROR_NONE,