From 6c18c91c1693b0eec75a69bd6f301d294307036d Mon Sep 17 00:00:00 2001 From: huanglei <1580437406@qq.com> Date: Mon, 21 Aug 2023 18:24:24 +0800 Subject: [PATCH] =?UTF-8?q?UserAgent=E6=96=AD=E8=A8=80=20Signed-off-by:=20?= =?UTF-8?q?huanglei=20<1580437406@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/MainAbility/pages/web.ets | 11 +++++++++++ .../entry/src/main/ets/test/WebJsunit.test.ets | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets index 1f39daf93..4adca28a3 100644 --- a/arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets +++ b/arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets @@ -948,6 +948,17 @@ struct Index { } break; } + + case "emitGetCustomUserAgent":{ + try { + let setUA = "userAgent" + this.controller.setCustomUserAgent(setUA) + Utils.emitEvent(this.controller.getCustomUserAgent(), 522); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + break; + } diff --git a/arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets b/arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets index ad8fcd60b..c40d49219 100644 --- a/arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets +++ b/arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets @@ -646,16 +646,25 @@ export default function webJsunit() { Utils.registerEvent("GetCertificateCallback",31,520,done); sendEventByKey('webcomponent',10,''); }) - /* *tc.number SUB_ACE_BASIC_ETS_API_060 *tc.name GetStoredGeolocationPromise *tc.desic Save current page */ it('GetStoredGeolocationPromise',0,async function(done){ - emitKey="emitGetStoredGeolocationPromise"; + emitKey="emitGetCustomUserAgent"; Utils.registerEvent("GetStoredGeolocationPromise","file:///",521,done); sendEventByKey('webcomponent',10,''); }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_061 + *tc.name getCustomUserAgent + *tc.desic Save current page + */ + it('GetCustomUserAgent',0,async function(done){ + emitKey="emitGetCustomUserAgent"; + Utils.registerEvent("GetCustomUserAgent","userAgent",522,done); + sendEventByKey('webcomponent',10,''); + }) }) } -- GitLab