5 #include "sw/device/silicon_creator/rom_ext/rom_ext_boot_policy.h" 
    7 #include "gtest/gtest.h" 
    8 #include "sw/device/silicon_creator/lib/mock_boot_data.h" 
    9 #include "sw/device/silicon_creator/lib/mock_manifest.h" 
   10 #include "sw/device/silicon_creator/rom_ext/mock_rom_ext_boot_policy_ptrs.h" 
   11 #include "sw/device/silicon_creator/testing/rom_test.h" 
   13 namespace manifest_unittest {
 
   15 using ::testing::Return;
 
   19   rom_test::MockRomExtBootPolicyPtrs rom_ext_boot_policy_ptrs_;
 
   20   rom_test::MockManifest mock_manifest_;
 
   21   rom_test::MockBootData mock_boot_data_;
 
   32   EXPECT_CALL(mock_manifest_, Check(&
manifest)).WillOnce(Return(kErrorOk));
 
   37   EXPECT_CALL(mock_manifest_, Check(&
manifest)).WillOnce(Return(kErrorOk));
 
   42   EXPECT_CALL(mock_manifest_, Check(&
manifest)).WillOnce(Return(kErrorOk));
 
   47 TEST_F(RomExtBootPolicyTest, ManifestCheckBadIdentifier) {
 
   52             kErrorBootPolicyBadIdentifier);
 
   55 TEST_F(RomExtBootPolicyTest, ManifestCheckBadLength) {
 
   62             kErrorBootPolicyBadLength);
 
   66             kErrorBootPolicyBadLength);
 
   69 TEST_F(RomExtBootPolicyTest, ManifestCheckBadBl0SecVer) {
 
   79             kErrorBootPolicyRollback);
 
   88       public testing::WithParamInterface<ManifestOrderTestCase> {};
 
   94   manifest_b.security_version = 1;
 
   96   EXPECT_CALL(rom_ext_boot_policy_ptrs_, ManifestA)
 
   97       .WillOnce(Return(&manifest_a));
 
   98   EXPECT_CALL(rom_ext_boot_policy_ptrs_, ManifestB)
 
   99       .WillOnce(Return(&manifest_b));
 
  102   if (GetParam().primary == kBootSlotA) {
 
  109       rom_ext_boot_policy_manifests_get(&
boot_data);
 
  110   if (GetParam().primary == kBootSlotA) {
 
  111     EXPECT_EQ(res.
ordered[0], &manifest_a);
 
  112     EXPECT_EQ(res.
ordered[1], &manifest_b);
 
  114     EXPECT_EQ(res.
ordered[0], &manifest_b);
 
  115     EXPECT_EQ(res.
ordered[1], &manifest_a);
 
  119 INSTANTIATE_TEST_SUITE_P(SecurityVersionCases, ManifestOrderTest,
 
  121                              ManifestOrderTestCase{
 
  122                                  .primary = kBootSlotA,
 
  124                              ManifestOrderTestCase{
 
  125                                  .primary = kBootSlotB,