5 #include "sw/device/silicon_creator/lib/boot_svc/boot_svc_ownership_activate.h"
9 #include "gtest/gtest.h"
10 #include "sw/device/silicon_creator/lib/boot_svc/mock_boot_svc_header.h"
11 #include "sw/device/silicon_creator/testing/rom_test.h"
13 namespace boot_svc_ownership_activate_unittest {
15 using ::testing::ElementsAreArray;
19 rom_test::MockBootSvcHeader boot_svc_header_;
24 constexpr uint32_t primary_bl0_slot = 0;
25 constexpr uint32_t erase_previous = 1;
28 107, 108, 109, 110, 111, 112, 113,
30 EXPECT_CALL(boot_svc_header_, Finalize(kBootSvcOwnershipActivateReqType,
31 sizeof(msg), &msg.header));
33 boot_svc_ownership_activate_req_init(primary_bl0_slot, erase_previous,
nonce,
36 EXPECT_EQ(msg.primary_bl0_slot, primary_bl0_slot);
37 EXPECT_EQ(msg.erase_previous, erase_previous);
38 EXPECT_EQ(msg.nonce.value[0],
nonce.value[0]);
39 EXPECT_EQ(msg.nonce.value[1],
nonce.value[1]);
40 EXPECT_EQ(
memcmp(&msg.signature, &signature,
sizeof(signature)), 0);
43 TEST_F(BootSvcOwnershipActivateTest, ResInit) {
45 constexpr rom_error_t kStatus = kErrorOk;
46 EXPECT_CALL(boot_svc_header_, Finalize(kBootSvcOwnershipActivateResType,
47 sizeof(msg), &msg.header));
49 boot_svc_ownership_activate_res_init(kStatus, &msg);
51 EXPECT_EQ(msg.status, kStatus);