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 ab84bcbd874be897e55d61b0114eeb31a74ad2b5..4adca28a3c52d6050ab666a25c4790820492c7f6 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,7 +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 ea62fc8a51fc84ef3e82f704068a9e39d4d5e1e4..c40d49219d1f499995f7a75989679bf36aac40f7 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,''); + }) }) }