From 9c8d84453fd79c6ae56568ae49073bf568fd24b5 Mon Sep 17 00:00:00 2001 From: wangzhaohao Date: Mon, 26 Aug 2024 11:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=B1=E8=B4=A5=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangzhaohao --- bundle.json | 5 ++++- deviceprofile.gni | 2 +- old/services/core/test/BUILD.gn | 4 +++- services/core/test/BUILD.gn | 3 +++ .../test/unittest/static_capability_collector_test.cpp | 4 +++- .../core/test/unittest/static_capability_loader_test.cpp | 8 +++++++- .../core/test/unittest/static_profile_manager_test.cpp | 4 +++- .../core/test/unittest/switch_profile_manager_test.cpp | 4 +++- 8 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bundle.json b/bundle.json index 4a91024a..48732c07 100644 --- a/bundle.json +++ b/bundle.json @@ -12,7 +12,10 @@ "component": { "name": "device_info_manager", "subsystem": "deviceprofile", - "features": [ "device_info_manager_feature_coverage" ], + "features": [ + "device_info_manager_feature_coverage", + "device_info_manager_switch_static_disable" + ], "adapted_system_type": [ "standard" ], "hisysevent_config":[ "//foundation/deviceprofile/device_info_manager/hisysevent.yaml" diff --git a/deviceprofile.gni b/deviceprofile.gni index 1eceeece..607ad0ac 100644 --- a/deviceprofile.gni +++ b/deviceprofile.gni @@ -10,7 +10,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +device_info_manager_switch_static_disable = true old_device_profile_path = "//foundation/deviceprofile/device_info_manager/old" old_device_profile_service = "//foundation/deviceprofile/device_info_manager/old/services" diff --git a/old/services/core/test/BUILD.gn b/old/services/core/test/BUILD.gn index 07d887be..9bf131e1 100644 --- a/old/services/core/test/BUILD.gn +++ b/old/services/core/test/BUILD.gn @@ -277,7 +277,6 @@ group("unittest") { ":profile_authority_test", ":profile_change_handler_test", ":profile_change_notification_test", - ":profile_crud_test", ":profile_dm_test", ":profile_entry_test", ":profile_event_notifier_proxy_test", @@ -289,4 +288,7 @@ group("unittest") { ":subscribe_info_test", ":subscribe_manager_test", ] + if (!device_info_manager_switch_static_disable) { + deps += [ ":profile_crud_test" ] + } } diff --git a/services/core/test/BUILD.gn b/services/core/test/BUILD.gn index 526e561e..9d491105 100644 --- a/services/core/test/BUILD.gn +++ b/services/core/test/BUILD.gn @@ -23,6 +23,9 @@ config("device_profile_test_config") { "-Dprivate=public", "-Dprotected=public", ] + if (!device_info_manager_switch_static_disable) { + cflags += [ "-DDEVICE_PROFILE_SWITCH_STATIC_ENABLE" ] + } } device_profile_configs = [ diff --git a/services/core/test/unittest/static_capability_collector_test.cpp b/services/core/test/unittest/static_capability_collector_test.cpp index d5a9933a..eea02e7c 100644 --- a/services/core/test/unittest/static_capability_collector_test.cpp +++ b/services/core/test/unittest/static_capability_collector_test.cpp @@ -68,6 +68,7 @@ HWTEST_F(StaticCapabilityCollectorTest, Init_001, TestSize.Level1) EXPECT_EQ(ret, DP_SUCCESS); } +#ifdef DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: CollectStaticCapability_001 * @tc.desc: Normal testCase of StaticCapabilityCollectorTest @@ -79,6 +80,7 @@ HWTEST_F(StaticCapabilityCollectorTest, CollectStaticCapability_001, TestSize.Le StaticCapabilityCollector::GetInstance().CollectStaticCapability(); EXPECT_EQ(ret, DP_SUCCESS); } +#endif // DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: UnInit_001 @@ -92,4 +94,4 @@ HWTEST_F(StaticCapabilityCollectorTest, UnInit_001, TestSize.Level1) EXPECT_EQ(ret, DP_SUCCESS); } } // namespace DistributedDeviceProfile -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/core/test/unittest/static_capability_loader_test.cpp b/services/core/test/unittest/static_capability_loader_test.cpp index 213dc46b..2bb3713d 100644 --- a/services/core/test/unittest/static_capability_loader_test.cpp +++ b/services/core/test/unittest/static_capability_loader_test.cpp @@ -70,6 +70,7 @@ HWTEST_F(StaticCapabilityLoaderTest, Init_001, TestSize.Level1) EXPECT_EQ(ret, DP_SUCCESS); } +#ifdef DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: LoadStaticCapability_001 * @tc.desc: Normal testCase of StaticCapabilityLoaderTest @@ -82,6 +83,7 @@ HWTEST_F(StaticCapabilityLoaderTest, LoadStaticCapability_001, TestSize.Level1) StaticCapabilityLoader::GetInstance().LoadStaticCapability(staticCapability); EXPECT_EQ(ret, DP_SUCCESS); } +#endif // DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: LoadJsonFile_001 @@ -569,6 +571,7 @@ HWTEST_F(StaticCapabilityLoaderTest, LoadStaticInfo_002, TestSize.Level1) EXPECT_EQ(ret, DP_INVALID_PARAM); } +#ifdef DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: LoadStaticInfo_003 * @tc.desc: Normal testCase of StaticCapabilityLoaderTest @@ -598,6 +601,7 @@ HWTEST_F(StaticCapabilityLoaderTest, LoadStaticInfo_004, TestSize.Level1) StaticCapabilityLoader::GetInstance().LoadStaticInfo(staticCapability, staticVersion, charProfiles); EXPECT_EQ(ret, DP_SUCCESS); } +#endif // DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: LoadStaticProfiles_001 @@ -647,6 +651,7 @@ HWTEST_F(StaticCapabilityLoaderTest, LoadStaticProfiles_003, TestSize.Level1) EXPECT_EQ(ret, DP_INVALID_PARAM); } +#ifdef DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: LoadStaticProfiles_004 * @tc.desc: Normal testCase of StaticCapabilityLoaderTest @@ -662,6 +667,7 @@ HWTEST_F(StaticCapabilityLoaderTest, LoadStaticProfiles_004, TestSize.Level1) GetInstance().LoadStaticProfiles(deviceId, staticCapability, staticVersion, charProfiles); EXPECT_EQ(ret, DP_GET_STATIC_INFO_FAIL); } +#endif // DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: InitStaticCapability_001 @@ -847,4 +853,4 @@ HWTEST_F(StaticCapabilityLoaderTest, UnInit_001, TestSize.Level1) EXPECT_EQ(ret, DP_SUCCESS); } } // namespace DistributedDeviceProfile -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/core/test/unittest/static_profile_manager_test.cpp b/services/core/test/unittest/static_profile_manager_test.cpp index 8de2d490..a5347c42 100644 --- a/services/core/test/unittest/static_profile_manager_test.cpp +++ b/services/core/test/unittest/static_profile_manager_test.cpp @@ -122,6 +122,7 @@ HWTEST_F(StaticProfileManagerTest, GetCharacteristicProfile_001, TestSize.Level1 EXPECT_EQ(errCode, DP_INVALID_PARAMS); } +#ifdef DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: GetAllCharacteristicProfile_001 * @tc.desc: GetAllCharacteristicProfile @@ -134,6 +135,7 @@ HWTEST_F(StaticProfileManagerTest, GetAllCharacteristicProfile_001, TestSize.Lev int32_t errCode = StaticProfileManager::GetInstance().GetAllCharacteristicProfile(staticCapabilityProfiles); EXPECT_EQ(errCode, DP_SUCCESS); } +#endif // DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: GenerateStaticInfoProfile_001 @@ -150,4 +152,4 @@ HWTEST_F(StaticProfileManagerTest, GenerateStaticInfoProfile_001, TestSize.Level EXPECT_EQ(errCode, DP_PARSE_STATIC_CAP_FAIL); } } // namespace DistributedDeviceProfile -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/core/test/unittest/switch_profile_manager_test.cpp b/services/core/test/unittest/switch_profile_manager_test.cpp index 45b924ce..36ba741c 100644 --- a/services/core/test/unittest/switch_profile_manager_test.cpp +++ b/services/core/test/unittest/switch_profile_manager_test.cpp @@ -55,6 +55,7 @@ void SwitchProfileManagerTest::TearDown() { } +#ifdef DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: Init_001 * @tc.desc: Init @@ -92,6 +93,7 @@ HWTEST_F(SwitchProfileManagerTest, ReInit_001, TestSize.Level1) int32_t errCode = SwitchProfileManager::GetInstance().ReInit(); EXPECT_EQ(errCode, DP_SUCCESS); } +#endif // DEVICE_PROFILE_SWITCH_STATIC_ENABLE /* * @tc.name: PutCharacteristicProfile_001 @@ -148,4 +150,4 @@ HWTEST_F(SwitchProfileManagerTest, RefreshLocalSwitchProfile_001, TestSize.Level EXPECT_EQ(errCode, DP_INVALID_PARAMS); } } // namespace DistributedDeviceProfile -} // namespace OHOS \ No newline at end of file +} // namespace OHOS