diff --git a/interfaces/kits/picker/BUILD.gn b/interfaces/kits/picker/BUILD.gn index ad3a443c1957f44d034fbd2b631a8f5054dcfa7d..8e7453c1c2bd697003982649c1dbcfb8a77a3ce0 100644 --- a/interfaces/kits/picker/BUILD.gn +++ b/interfaces/kits/picker/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2023 Huawei Device Co., Ltd. +# Copyright (C) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -11,15 +11,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") -import("../../../../../../arkcompiler/ets_frontend/es2panda/es2abc_config.gni") -import("../../../filemanagement_aafwk.gni") +import("//foundation/filemanagement/user_file_service/filemanagement_aafwk.gni") # compile .js to .abc. action("gen_picker_abc") { visibility = [ ":*" ] - script = "../../../../../../arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py" + script = + "//arkcompiler/ets_frontend/es2panda/scripts/generate_js_bytecode.py" args = [ "--src-js", @@ -30,8 +31,7 @@ action("gen_picker_abc") { rebase_path("${es2abc_build_path}"), "--module", ] - deps = - [ "../../../../../../arkcompiler/ets_frontend/es2panda:es2panda_build" ] + external_deps = [ "ets_frontend:ets2panda" ] inputs = [ "picker.js" ] outputs = [ target_out_dir + "/picker.abc" ] } diff --git a/services/native/file_access_service/src/file_access_service.cpp b/services/native/file_access_service/src/file_access_service.cpp index 6001e2b3090ae9c744e80ea9d706d6c9681261b3..b4c48efb33e74e0f84899408f2ce4df3f3c991b7 100644 --- a/services/native/file_access_service/src/file_access_service.cpp +++ b/services/native/file_access_service/src/file_access_service.cpp @@ -313,7 +313,9 @@ int32_t FileAccessService::OperateObsNode(Uri &uri, bool notifyForDescendants, u auto haveCodeIter = find_if(obsNode->obsCodeList_.begin(), obsNode->obsCodeList_.end(), [code](const uint32_t &listCode) { return code == listCode; }); if (haveCodeIter != obsNode->obsCodeList_.end()) { - obsManager_.get(code)->UnRef(); + if (obsManager_.get(code) != nullptr) { + obsManager_.get(code)->UnRef(); + } if (obsNode->needChildNote_ == notifyForDescendants) { HILOG_DEBUG("Register same uri and same callback and same notifyForDescendants"); return ERR_OK; diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index f844c853e8e6197dcf55e85c0d4287ceafa962f9..f68476f365f69bfcee8255ee00dd7d94f7de6ee5 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -32,7 +32,6 @@ ohos_unittest("medialibrary_file_access_test") { include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", "${user_file_service_path}/interfaces/inner_api/file_access/include", - "//third_party/googletest/googlemock/include/gmock", "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx/", ] @@ -42,7 +41,6 @@ ohos_unittest("medialibrary_file_access_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "${ability_runtime_path}/frameworks/native/appkit:app_context", "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", - "//third_party/googletest:gmock_main", ] external_deps = [ @@ -57,6 +55,8 @@ ohos_unittest("medialibrary_file_access_test") { "access_token:libnativetoken", "access_token:libtoken_setproc", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "ipc:ipc_core", "ipc:rpc", "samgr:samgr_proxy", @@ -84,7 +84,6 @@ ohos_unittest("external_file_access_basic_test") { include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", - "//third_party/googletest/googlemock/include/gmock", "${user_file_service_path}/interfaces/inner_api/file_access/include", "${user_file_service_path}/services/native/file_access_service/include", ] @@ -96,7 +95,6 @@ ohos_unittest("external_file_access_basic_test") { "${ability_runtime_path}/frameworks/native/appkit:app_context", "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", "${user_file_service_path}/services:file_access_service", - "//third_party/googletest:gmock_main", ] external_deps = [ @@ -112,6 +110,8 @@ ohos_unittest("external_file_access_basic_test") { "access_token:libtoken_setproc", "bundle_framework:appexecfwk_core", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "ipc:rpc", @@ -139,7 +139,6 @@ ohos_unittest("external_file_access_management_test") { include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", - "//third_party/googletest/googlemock/include/gmock", "${user_file_service_path}/interfaces/inner_api/file_access/include", "${user_file_service_path}/services/native/file_access_service/include", ] @@ -151,7 +150,6 @@ ohos_unittest("external_file_access_management_test") { "${ability_runtime_path}/frameworks/native/appkit:app_context", "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", "${user_file_service_path}/services:file_access_service", - "//third_party/googletest:gmock_main", ] external_deps = [ @@ -167,6 +165,8 @@ ohos_unittest("external_file_access_management_test") { "access_token:libtoken_setproc", "bundle_framework:appexecfwk_core", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "ipc:rpc", @@ -190,7 +190,6 @@ ohos_unittest("external_file_access_notify_test") { include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", - "//third_party/googletest/googlemock/include/gmock", "${user_file_service_path}/interfaces/inner_api/file_access/include", "${user_file_service_path}/services/native/file_access_service/include", ] @@ -202,7 +201,6 @@ ohos_unittest("external_file_access_notify_test") { "${ability_runtime_path}/frameworks/native/appkit:app_context", "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", "${user_file_service_path}/services:file_access_service", - "//third_party/googletest:gmock_main", ] external_deps = [ @@ -218,6 +216,8 @@ ohos_unittest("external_file_access_notify_test") { "access_token:libtoken_setproc", "bundle_framework:appexecfwk_core", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "ipc:rpc", @@ -239,7 +239,6 @@ ohos_unittest("abnormal_file_access_test") { include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", - "//third_party/googletest/googlemock/include/gmock", "${user_file_service_path}/interfaces/inner_api/file_access/include", ] @@ -249,7 +248,6 @@ ohos_unittest("abnormal_file_access_test") { "${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native", "${ability_runtime_path}/frameworks/native/appkit:app_context", "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", - "//third_party/googletest:gmock_main", ] external_deps = [ @@ -265,6 +263,8 @@ ohos_unittest("abnormal_file_access_test") { "access_token:libtoken_setproc", "bundle_framework:appexecfwk_core", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", @@ -289,7 +289,6 @@ ohos_unittest("file_access_ext_stub_impl_test") { "${user_file_service_path}/interfaces/inner_api/file_access/include", "${user_file_service_path}/interfaces/kits/js/src/common", "${user_file_service_path}/utils", - "//third_party/googletest/googlemock/include/gmock", "mock", ] @@ -298,8 +297,6 @@ ohos_unittest("file_access_ext_stub_impl_test") { "file_access_ext_stub_impl_test.cpp", ] - deps = [ "//third_party/googletest:gmock_main" ] - external_deps = [ "ability_base:zuri", "ability_runtime:app_context", @@ -307,6 +304,8 @@ ohos_unittest("file_access_ext_stub_impl_test") { "ability_runtime:napi_common", "ability_runtime:runtime", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_core", @@ -333,7 +332,6 @@ ohos_unittest("file_access_service_proxy_test") { "${user_file_service_path}/services/native/file_access_service/include", "${user_file_service_path}/interfaces/kits/js/src/common", "${user_file_service_path}/utils", - "//third_party/googletest/googlemock/include/gmock", "mock", ] @@ -344,17 +342,14 @@ ohos_unittest("file_access_service_proxy_test") { "mock/service_registry_mock.cpp", ] - deps = [ - "//third_party/googletest:gmock_main", - "//third_party/googletest:gtest_main", - ] - external_deps = [ "ability_base:want", "ability_base:zuri", "ability_runtime:ability_manager", "bundle_framework:appexecfwk_core", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "hitrace:hitrace_meter", "image_framework:image", @@ -388,7 +383,6 @@ ohos_unittest("js_file_access_ext_ability_test") { "${user_file_service_path}/interfaces/kits/js/src/common", "${user_file_service_path}/services/native/file_access_service/include", "${user_file_service_path}/utils", - "//third_party/googletest/googlemock/include/gmock", "mock", ] @@ -400,9 +394,7 @@ ohos_unittest("js_file_access_ext_ability_test") { ] deps = [ - "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit", - "//third_party/googletest:gmock_main", - "//third_party/googletest:gtest_main", + "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit" ] external_deps = [ @@ -415,6 +407,8 @@ ohos_unittest("js_file_access_ext_ability_test") { "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_core", "c_utils:utils", + "googletest:gmock_main", + "googletest:gtest_main", "hilog:libhilog", "hitrace:hitrace_meter", "init:libbegetutil",