From f447d13a8d4cd1788fc860cfcbd47c536fbdc880 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?fixed=206c18c91=20from=20https://gitee.com/huan?= =?UTF-8?q?glei-AAA/xts=5Facts/pulls/9812=20UserAgent=E6=96=AD=E8=A8=80=20?= =?UTF-8?q?Signed-off-by:=20huanglei=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 | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) 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 ab84bcbd8..56d0be677 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 ea62fc8a5..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 @@ -652,9 +652,19 @@ export default function webJsunit() { *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