1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "session_proxy.h" 17 #include "iremote_object_mocker.h" 18 #include <gtest/gtest.h> 19 #include "accessibility_event_info.h" 20 #include "ws_common.h" 21 #include "mock_message_parcel.h" 22 #include "pointer_event.h" 23 24 // using namespace FRAME_TRACE; 25 using namespace testing; 26 using namespace testing::ext; 27 28 namespace OHOS { 29 namespace Rosen { 30 class SessionProxyTest : public testing::Test { 31 public: SessionProxyTest()32 SessionProxyTest() {} ~SessionProxyTest()33 ~SessionProxyTest() {} 34 }; 35 namespace { 36 37 /** 38 * @tc.name: OnSessionEvent 39 * @tc.desc: normal function 40 * @tc.type: FUNC 41 */ 42 HWTEST_F(SessionProxyTest, OnSessionEvent, Function | SmallTest | Level2) 43 { 44 GTEST_LOG_(INFO) << "SessionProxyTest: OnSessionEvent start"; 45 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 46 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 47 SessionEvent event = SessionEvent::EVENT_MAXIMIZE; 48 WSError res = sProxy->OnSessionEvent(event); 49 ASSERT_EQ(res, WSError::WS_OK); 50 GTEST_LOG_(INFO) << "SessionProxyTest: OnSessionEvent end"; 51 } 52 53 /** 54 * @tc.name: UpdateSessionRect 55 * @tc.desc: normal function 56 * @tc.type: FUNC 57 */ 58 HWTEST_F(SessionProxyTest, UpdateSessionRect, Function | SmallTest | Level2) 59 { 60 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateSessionRect start"; 61 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 62 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 63 WSRect rect{.posX_ = 1, .posY_ = 1, .width_ = 100, .height_ = 100}; 64 SizeChangeReason reason = SizeChangeReason::RECOVER; 65 WSError res = sProxy->UpdateSessionRect(rect, reason); 66 ASSERT_EQ(res, WSError::WS_OK); 67 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateSessionRect end"; 68 } 69 70 /** 71 * @tc.name: Restore 72 * @tc.desc: normal function 73 * @tc.type: FUNC 74 */ 75 HWTEST_F(SessionProxyTest, OnRestoreMainWindow, Function | SmallTest | Level2) 76 { 77 GTEST_LOG_(INFO) << "SessionProxyTest: OnRestoreMainWindow start"; 78 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 79 ASSERT_NE(iRemoteObjectMocker, nullptr); 80 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 81 ASSERT_NE(sProxy, nullptr); 82 WSError res = sProxy->OnRestoreMainWindow(); 83 ASSERT_EQ(res, WSError::WS_OK); 84 GTEST_LOG_(INFO) << "SessionProxyTest: OnRestoreMainWindow end"; 85 } 86 87 /** 88 * @tc.name: RaiseToAppTop 89 * @tc.desc: normal function 90 * @tc.type: FUNC 91 */ 92 HWTEST_F(SessionProxyTest, RaiseToAppTop, Function | SmallTest | Level2) 93 { 94 GTEST_LOG_(INFO) << "SessionProxyTest: RaiseToAppTop start"; 95 sptr<MockIRemoteObject> remoteMocker = sptr<MockIRemoteObject>::MakeSptr(); 96 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(remoteMocker); 97 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 98 WSError res = sProxy->RaiseToAppTop(); 99 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 100 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(false); 101 102 sptr<SessionProxy> tempProxy = sptr<SessionProxy>::MakeSptr(nullptr); 103 res = tempProxy->RaiseToAppTop(); 104 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 105 106 remoteMocker->SetRequestResult(ERR_INVALID_DATA); 107 res = sProxy->RaiseToAppTop(); 108 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 109 remoteMocker->SetRequestResult(ERR_NONE); 110 111 res = sProxy->RaiseToAppTop(); 112 ASSERT_EQ(res, WSError::WS_OK); 113 114 GTEST_LOG_(INFO) << "SessionProxyTest: RaiseToAppTop end"; 115 } 116 117 /** 118 * @tc.name: RaiseAboveTarget 119 * @tc.desc: normal function 120 * @tc.type: FUNC 121 */ 122 HWTEST_F(SessionProxyTest, RaiseAboveTarget, Function | SmallTest | Level2) 123 { 124 GTEST_LOG_(INFO) << "SessionProxyTest: RaiseAboveTarget start"; 125 sptr<MockIRemoteObject> remoteMocker = sptr<MockIRemoteObject>::MakeSptr(); 126 sptr<SessionProxy> proxy = sptr<SessionProxy>::MakeSptr(remoteMocker); 127 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 128 int32_t subWindowId = 0; 129 WSError res = proxy->RaiseAboveTarget(subWindowId); 130 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 131 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(false); 132 133 sptr<SessionProxy> tempProxy = sptr<SessionProxy>::MakeSptr(nullptr); 134 res = tempProxy->RaiseAboveTarget(subWindowId); 135 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 136 137 remoteMocker->SetRequestResult(ERR_INVALID_DATA); 138 res = proxy->RaiseAboveTarget(subWindowId); 139 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 140 remoteMocker->SetRequestResult(ERR_NONE); 141 142 res = proxy->RaiseAboveTarget(subWindowId); 143 ASSERT_EQ(res, WSError::WS_OK); 144 145 GTEST_LOG_(INFO) << "SessionProxyTest: RaiseAboveTarget end"; 146 } 147 148 /** 149 * @tc.name: OnNeedAvoid 150 * @tc.desc: normal function 151 * @tc.type: FUNC 152 */ 153 HWTEST_F(SessionProxyTest, OnNeedAvoid, Function | SmallTest | Level2) 154 { 155 GTEST_LOG_(INFO) << "SessionProxyTest: OnNeedAvoid start"; 156 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 157 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 158 bool status = false; 159 WSError res = sProxy->OnNeedAvoid(status); 160 ASSERT_EQ(res, WSError::WS_OK); 161 162 GTEST_LOG_(INFO) << "SessionProxyTest: OnNeedAvoid end"; 163 } 164 165 /** 166 * @tc.name: RequestSessionBack 167 * @tc.desc: normal function 168 * @tc.type: FUNC 169 */ 170 HWTEST_F(SessionProxyTest, RequestSessionBack, Function | SmallTest | Level2) 171 { 172 GTEST_LOG_(INFO) << "SessionProxyTest: RequestSessionBack start"; 173 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 174 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 175 bool needMoveToBackground = true; 176 WSError res = sProxy->RequestSessionBack(needMoveToBackground); 177 ASSERT_EQ(res, WSError::WS_OK); 178 179 GTEST_LOG_(INFO) << "SessionProxyTest: RequestSessionBack end"; 180 } 181 182 /** 183 * @tc.name: MarkProcessed 184 * @tc.desc: normal function 185 * @tc.type: FUNC 186 */ 187 HWTEST_F(SessionProxyTest, MarkProcessed, Function | SmallTest | Level2) 188 { 189 GTEST_LOG_(INFO) << "SessionProxyTest: MarkProcessed start"; 190 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 191 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 192 int32_t eventId = 0; 193 WSError res = sProxy->MarkProcessed(eventId); 194 ASSERT_EQ(res, WSError::WS_OK); 195 196 GTEST_LOG_(INFO) << "SessionProxyTest: MarkProcessed end"; 197 } 198 199 /** 200 * @tc.name: SetGlobalMaximizeMode 201 * @tc.desc: normal function 202 * @tc.type: FUNC 203 */ 204 HWTEST_F(SessionProxyTest, SetGlobalMaximizeMode, Function | SmallTest | Level2) 205 { 206 GTEST_LOG_(INFO) << "SessionProxyTest: SetGlobalMaximizeMode start"; 207 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 208 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 209 MaximizeMode mode = MaximizeMode::MODE_AVOID_SYSTEM_BAR; 210 WSError res = sProxy->SetGlobalMaximizeMode(mode); 211 ASSERT_EQ(res, WSError::WS_OK); 212 213 GTEST_LOG_(INFO) << "SessionProxyTest: SetGlobalMaximizeMode end"; 214 } 215 216 /** 217 * @tc.name: GetGlobalMaximizeMode 218 * @tc.desc: normal function 219 * @tc.type: FUNC 220 */ 221 HWTEST_F(SessionProxyTest, GetGlobalMaximizeMode, Function | SmallTest | Level2) 222 { 223 GTEST_LOG_(INFO) << "SessionProxyTest: GetGlobalMaximizeMode start"; 224 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 225 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 226 MaximizeMode mode = MaximizeMode::MODE_AVOID_SYSTEM_BAR; 227 WSError res = sProxy->GetGlobalMaximizeMode(mode); 228 ASSERT_EQ(res, WSError::WS_OK); 229 230 GTEST_LOG_(INFO) << "SessionProxyTest: GetGlobalMaximizeMode end"; 231 } 232 233 /** 234 * @tc.name: SetAspectRatio 235 * @tc.desc: normal function 236 * @tc.type: FUNC 237 */ 238 HWTEST_F(SessionProxyTest, SetAspectRatio, Function | SmallTest | Level2) 239 { 240 GTEST_LOG_(INFO) << "SessionProxyTest: SetAspectRatio start"; 241 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 242 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 243 float ratio = 10; 244 WSError res = sProxy->SetAspectRatio(ratio); 245 ASSERT_EQ(res, WSError::WS_OK); 246 247 GTEST_LOG_(INFO) << "SessionProxyTest: SetAspectRatio end"; 248 } 249 250 /** 251 * @tc.name: UpdateWindowSceneAfterCustomAnimation 252 * @tc.desc: normal function 253 * @tc.type: FUNC 254 */ 255 HWTEST_F(SessionProxyTest, UpdateWindowSceneAfterCustomAnimation, Function | SmallTest | Level2) 256 { 257 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateWindowSceneAfterCustomAnimation start"; 258 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 259 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 260 bool isAdd = false; 261 WSError res = sProxy->UpdateWindowSceneAfterCustomAnimation(isAdd); 262 ASSERT_EQ(res, WSError::WS_OK); 263 264 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateWindowSceneAfterCustomAnimation end"; 265 } 266 267 /** 268 * @tc.name: SetSystemWindowEnableDrag 269 * @tc.desc: normal function 270 * @tc.type: FUNC 271 */ 272 HWTEST_F(SessionProxyTest, SetSystemWindowEnableDrag, Function | SmallTest | Level2) 273 { 274 GTEST_LOG_(INFO) << "SessionProxyTest: SetSystemWindowEnableDrag start"; 275 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 276 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 277 bool enableDrag = false; 278 WMError res = sProxy->SetSystemWindowEnableDrag(enableDrag); 279 ASSERT_EQ(res, WMError::WM_OK); 280 281 GTEST_LOG_(INFO) << "SessionProxyTest: SetSystemWindowEnableDrag end"; 282 } 283 284 /** 285 * @tc.name: TransferAbilityResult 286 * @tc.desc: normal function 287 * @tc.type: FUNC 288 */ 289 HWTEST_F(SessionProxyTest, TransferAbilityResult, Function | SmallTest | Level2) 290 { 291 GTEST_LOG_(INFO) << "SessionProxyTest: TransferAbilityResult start"; 292 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 293 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 294 uint32_t resultCode = 0; 295 AAFwk::Want want; 296 WSError res = sProxy->TransferAbilityResult(resultCode, want); 297 ASSERT_EQ(res, WSError::WS_OK); 298 299 GTEST_LOG_(INFO) << "SessionProxyTest: TransferAbilityResult end"; 300 } 301 302 /** 303 * @tc.name: NotifyExtensionDied 304 * @tc.desc: normal function 305 * @tc.type: FUNC 306 */ 307 HWTEST_F(SessionProxyTest, NotifyExtensionDied, Function | SmallTest | Level2) 308 { 309 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyExtensionDied start"; 310 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 311 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 312 sProxy->NotifyExtensionDied(); 313 314 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyExtensionDied end"; 315 } 316 317 /** 318 * @tc.name: NotifyExtensionTimeout 319 * @tc.desc: normal function 320 * @tc.type: FUNC 321 */ 322 HWTEST_F(SessionProxyTest, NotifyExtensionTimeout, Function | SmallTest | Level2) 323 { 324 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyExtensionTimeout start"; 325 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 326 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 327 sProxy->NotifyExtensionTimeout(2); 328 329 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyExtensionTimeout end"; 330 } 331 332 /** 333 * @tc.name: UpdateWindowAnimationFlag 334 * @tc.desc: normal function 335 * @tc.type: FUNC 336 */ 337 HWTEST_F(SessionProxyTest, UpdateWindowAnimationFlag, Function | SmallTest | Level2) 338 { 339 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateWindowAnimationFlag start"; 340 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 341 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 342 bool needDefaultAnimationFlag = false; 343 WSError res = sProxy->UpdateWindowAnimationFlag(needDefaultAnimationFlag); 344 ASSERT_EQ(res, WSError::WS_OK); 345 346 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateWindowAnimationFlag end"; 347 } 348 349 /** 350 * @tc.name: TransferAccessibilityEvent 351 * @tc.desc: normal function 352 * @tc.type: FUNC 353 */ 354 HWTEST_F(SessionProxyTest, TransferAccessibilityEvent, Function | SmallTest | Level2) 355 { 356 GTEST_LOG_(INFO) << "SessionProxyTest: TransferAccessibilityEvent start"; 357 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 358 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 359 Accessibility::AccessibilityEventInfo info; 360 int64_t uiExtensionIdLevel = 0; 361 WSError res = sProxy->TransferAccessibilityEvent(info, uiExtensionIdLevel); 362 ASSERT_EQ(res, WSError::WS_OK); 363 364 GTEST_LOG_(INFO) << "SessionProxyTest: TransferAccessibilityEvent end"; 365 } 366 367 /** 368 * @tc.name: OnTitleAndDockHoverShowChange 369 * @tc.desc: normal function 370 * @tc.type: FUNC 371 */ 372 HWTEST_F(SessionProxyTest, OnTitleAndDockHoverShowChange, Function | SmallTest | Level2) 373 { 374 GTEST_LOG_(INFO) << "SessionProxyTest: OnTitleAndDockHoverShowChange start"; 375 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 376 ASSERT_NE(iRemoteObjectMocker, nullptr); 377 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 378 ASSERT_NE(sProxy, nullptr); 379 bool isTitleHoverShown = true; 380 bool isDockHoverShown = true; 381 WSError res = sProxy->OnTitleAndDockHoverShowChange(isTitleHoverShown, isDockHoverShown); 382 EXPECT_EQ(res, WSError::WS_OK); 383 GTEST_LOG_(INFO) << "SessionProxyTest: OnTitleAndDockHoverShowChange end"; 384 } 385 386 /** 387 * @tc.name: UpdatePiPControlStatus 388 * @tc.desc: normal function 389 * @tc.type: FUNC 390 */ 391 HWTEST_F(SessionProxyTest, UpdatePiPControlStatus, Function | SmallTest | Level2) 392 { 393 GTEST_LOG_(INFO) << "SessionProxyTest: UpdatePiPControlStatus start"; 394 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 395 ASSERT_NE(iRemoteObjectMocker, nullptr); 396 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 397 ASSERT_NE(sProxy, nullptr); 398 auto controlType = WsPiPControlType::VIDEO_PLAY_PAUSE; 399 auto status = WsPiPControlStatus::PLAY; 400 WSError res = sProxy->UpdatePiPControlStatus(controlType, status); 401 ASSERT_EQ(res, WSError::WS_OK); 402 GTEST_LOG_(INFO) << "SessionProxyTest: UpdatePiPControlStatus end"; 403 } 404 405 /** 406 * @tc.name: SetAutoStartPiP 407 * @tc.desc: sessionStub sessionStubTest 408 * @tc.type: FUNC 409 * @tc.require: #I6JLSI 410 */ 411 HWTEST_F(SessionProxyTest, SetAutoStartPiP, Function | SmallTest | Level2) 412 { 413 GTEST_LOG_(INFO) << "SetAutoStartPiP: SetAutoStartPiP start"; 414 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 415 ASSERT_NE(iRemoteObjectMocker, nullptr); 416 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 417 ASSERT_NE(sProxy, nullptr); 418 bool isAutoStartValid = true; 419 uint32_t priority = 0; 420 uint32_t width = 0; 421 uint32_t height = 0; 422 ASSERT_EQ(WSError::WS_OK, sProxy->SetAutoStartPiP(isAutoStartValid, priority, width, height)); 423 GTEST_LOG_(INFO) << "SetAutoStartPiP: SetAutoStartPiP end"; 424 } 425 426 /** 427 * @tc.name: GetGlobalScaledRect 428 * @tc.desc: normal function 429 * @tc.type: FUNC 430 */ 431 HWTEST_F(SessionProxyTest, GetGlobalScaledRect, Function | SmallTest | Level2) 432 { 433 GTEST_LOG_(INFO) << "SessionProxyTest: GetGlobalScaledRect start"; 434 Rect rect; 435 sptr<MockIRemoteObject> remoteMocker = sptr<MockIRemoteObject>::MakeSptr(); 436 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(remoteMocker); 437 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 438 WMError res = sProxy->GetGlobalScaledRect(rect); 439 ASSERT_EQ(res, WMError::WM_ERROR_IPC_FAILED); 440 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(false); 441 442 sptr<SessionProxy> tempProxy = sptr<SessionProxy>::MakeSptr(nullptr); 443 res = tempProxy->GetGlobalScaledRect(rect); 444 ASSERT_EQ(res, WMError::WM_ERROR_IPC_FAILED); 445 446 remoteMocker->SetRequestResult(ERR_INVALID_DATA); 447 res = sProxy->GetGlobalScaledRect(rect); 448 ASSERT_EQ(res, WMError::WM_ERROR_IPC_FAILED); 449 remoteMocker->SetRequestResult(ERR_NONE); 450 451 MockMessageParcel::SetReadInt32ErrorFlag(true); 452 MockMessageParcel::SetReadUint32ErrorFlag(true); 453 res = sProxy->GetGlobalScaledRect(rect); 454 ASSERT_EQ(res, WMError::WM_ERROR_IPC_FAILED); 455 456 MockMessageParcel::ClearAllErrorFlag(); 457 res = sProxy->GetGlobalScaledRect(rect); 458 ASSERT_EQ(res, WMError::WM_OK); 459 GTEST_LOG_(INFO) << "SessionProxyTest: GetGlobalScaledRect end"; 460 } 461 462 /** 463 * @tc.name: GetStatusBarHeight 464 * @tc.desc: normal function 465 * @tc.type: FUNC 466 */ 467 HWTEST_F(SessionProxyTest, GetStatusBarHeight, Function | SmallTest | Level2) 468 { 469 GTEST_LOG_(INFO) << "SessionProxyTest: GetStatusBarHeight start"; 470 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 471 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 472 int32_t res = sProxy->GetStatusBarHeight(); 473 ASSERT_EQ(res, 0); 474 GTEST_LOG_(INFO) << "SessionProxyTest: GetStatusBarHeight end"; 475 } 476 477 /** 478 * @tc.name: SetDialogSessionBackGestureEnabled 479 * @tc.desc: normal function 480 * @tc.type: FUNC 481 */ 482 HWTEST_F(SessionProxyTest, SetDialogSessionBackGestureEnabled, Function | SmallTest | Level2) 483 { 484 GTEST_LOG_(INFO) << "SessionProxyTest: SetDialogSessionBackGestureEnabled start"; 485 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 486 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 487 WSError res = sProxy->SetDialogSessionBackGestureEnabled(true); 488 ASSERT_EQ(res, WSError::WS_OK); 489 GTEST_LOG_(INFO) << "SessionProxyTest: SetDialogSessionBackGestureEnabled end"; 490 } 491 492 /** 493 * @tc.name: GetAppForceLandscapeConfig 494 * @tc.desc: normal function 495 * @tc.type: FUNC 496 */ 497 HWTEST_F(SessionProxyTest, GetAppForceLandscapeConfig, Function | SmallTest | Level2) 498 { 499 GTEST_LOG_(INFO) << "SessionProxyTest: GetAppForceLandscapeConfig start"; 500 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 501 ASSERT_NE(iRemoteObjectMocker, nullptr); 502 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 503 ASSERT_NE(sProxy, nullptr); 504 AppForceLandscapeConfig config = {}; 505 auto res = sProxy->GetAppForceLandscapeConfig(config); 506 ASSERT_EQ(res, WMError::WM_OK); 507 GTEST_LOG_(INFO) << "SessionProxyTest: GetAppForceLandscapeConfig end"; 508 } 509 510 /** 511 * @tc.name: NotifyExtensionEventAsync 512 * @tc.desc: NotifyExtensionEventAsync test 513 * @tc.type: FUNC 514 */ 515 HWTEST_F(SessionProxyTest, NotifyExtensionEventAsync, Function | SmallTest | Level2) 516 { 517 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 518 ASSERT_NE(sProxy, nullptr); 519 sProxy->NotifyExtensionEventAsync(0); 520 521 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 522 ASSERT_NE(iRemoteObjectMocker, nullptr); 523 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 524 ASSERT_NE(sProxy, nullptr); 525 sProxy->NotifyExtensionEventAsync(0); 526 527 MockMessageParcel::SetWriteUint32ErrorFlag(true); 528 sProxy->NotifyExtensionEventAsync(0); 529 530 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 531 sProxy->NotifyExtensionEventAsync(0); 532 MockMessageParcel::ClearAllErrorFlag(); 533 } 534 535 /** 536 * @tc.name: RequestFocus 537 * @tc.desc: RequestFocus Test 538 * @tc.type: FUNC 539 */ 540 HWTEST_F(SessionProxyTest, RequestFocus, Function | SmallTest | Level2) 541 { 542 GTEST_LOG_(INFO) << "SessionProxyTest: RequestFocus start"; 543 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 544 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 545 WSError res = sProxy->RequestFocus(true); 546 ASSERT_EQ(res, WSError::WS_OK); 547 GTEST_LOG_(INFO) << "SessionProxyTest: RequestFocus end"; 548 } 549 550 /** 551 * @tc.name: UpdateClientRect01 552 * @tc.desc: UpdateClientRect test 553 * @tc.type: FUNC 554 */ 555 HWTEST_F(SessionProxyTest, UpdateClientRect01, Function | SmallTest | Level2) 556 { 557 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateClientRect01 start"; 558 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 559 WSRect rect = { 200, 200, 200, 200 }; 560 ASSERT_EQ(sProxy->UpdateClientRect(rect), WSError::WS_ERROR_IPC_FAILED); 561 562 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 563 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 564 ASSERT_EQ(sProxy->UpdateClientRect(rect), WSError::WS_OK); 565 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateClientRect01 start"; 566 } 567 568 /** 569 * @tc.name: TransferExtensionData 570 * @tc.desc: TransferExtensionData test 571 * @tc.type: FUNC 572 */ 573 HWTEST_F(SessionProxyTest, TransferExtensionData, Function | SmallTest | Level2) 574 { 575 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 576 ASSERT_NE(sProxy, nullptr); 577 AAFwk::WantParams wantParams; 578 auto res = sProxy->TransferExtensionData(wantParams); 579 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 580 581 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 582 ASSERT_NE(iRemoteObjectMocker, nullptr); 583 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 584 ASSERT_NE(sProxy, nullptr); 585 586 res = sProxy->TransferExtensionData(wantParams); 587 ASSERT_EQ(res, WSError::WS_OK); 588 MockMessageParcel::SetWriteParcelableErrorFlag(true); 589 res = sProxy->TransferExtensionData(wantParams); 590 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 591 592 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 593 res = sProxy->TransferExtensionData(wantParams); 594 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 595 MockMessageParcel::ClearAllErrorFlag(); 596 } 597 598 /** 599 * @tc.name: NotifyAsyncOn 600 * @tc.desc: NotifyAsyncOn test 601 * @tc.type: FUNC 602 */ 603 HWTEST_F(SessionProxyTest, NotifyAsyncOn, Function | SmallTest | Level2) 604 { 605 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 606 ASSERT_NE(sProxy, nullptr); 607 sProxy->NotifyAsyncOn(); 608 609 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 610 ASSERT_NE(iRemoteObjectMocker, nullptr); 611 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 612 ASSERT_NE(sProxy, nullptr); 613 sProxy->NotifyAsyncOn(); 614 615 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 616 sProxy->NotifyAsyncOn(); 617 MockMessageParcel::ClearAllErrorFlag(); 618 } 619 620 /** 621 * @tc.name: OnSetWindowRectAutoSave 622 * @tc.desc: normal function 623 * @tc.type: FUNC 624 */ 625 HWTEST_F(SessionProxyTest, OnSetWindowRectAutoSave, Function | SmallTest | Level2) 626 { 627 GTEST_LOG_(INFO) << "SessionProxyTest: OnSetWindowRectAutoSave start"; 628 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 629 ASSERT_NE(iRemoteObjectMocker, nullptr); 630 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 631 ASSERT_NE(sProxy, nullptr); 632 WSError res = sProxy->OnSetWindowRectAutoSave(true, false); 633 ASSERT_EQ(res, WSError::WS_OK); 634 GTEST_LOG_(INFO) << "SessionProxyTest: OnSetWindowRectAutoSave end"; 635 } 636 637 /** 638 * @tc.name: NotifyMainModalTypeChange 639 * @tc.desc: NotifyMainModalTypeChange test 640 * @tc.type: FUNC 641 */ 642 HWTEST_F(SessionProxyTest, NotifyMainModalTypeChange, Function | SmallTest | Level2) 643 { 644 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyMainModalTypeChange start"; 645 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 646 ASSERT_EQ(sProxy->NotifyMainModalTypeChange(true), WSError::WS_ERROR_IPC_FAILED); 647 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 648 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 649 ASSERT_EQ(sProxy->NotifyMainModalTypeChange(true), WSError::WS_OK); 650 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyMainModalTypeChange end"; 651 } 652 653 /** 654 * @tc.name: Foreground 655 * @tc.desc: Foreground test 656 * @tc.type: FUNC 657 */ 658 HWTEST_F(SessionProxyTest, Foreground, Function | SmallTest | Level2) 659 { 660 GTEST_LOG_(INFO) << "SessionProxyTest: Foreground start"; 661 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 662 ASSERT_NE(sProxy, nullptr); 663 664 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr(); 665 ASSERT_NE(property, nullptr); 666 bool isFromClient = true; 667 std::string identityToken = "foregroundTest"; 668 WSError ret = sProxy->Foreground(property, isFromClient, identityToken); 669 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 670 GTEST_LOG_(INFO) << "SessionProxyTest: Foreground end"; 671 } 672 673 /** 674 * @tc.name: Foreground02 675 * @tc.desc: Foreground test property is nullptr 676 * @tc.type: FUNC 677 */ 678 HWTEST_F(SessionProxyTest, Foreground02, Function | SmallTest | Level2) 679 { 680 GTEST_LOG_(INFO) << "SessionProxyTest: Foreground02 start"; 681 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 682 ASSERT_NE(sProxy, nullptr); 683 684 bool isFromClient = true; 685 std::string identityToken = "foregroundTest"; 686 WSError ret = sProxy->Foreground(nullptr, isFromClient, identityToken); 687 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 688 GTEST_LOG_(INFO) << "SessionProxyTest: Foreground02 end"; 689 } 690 691 /** 692 * @tc.name: Foreground03 693 * @tc.desc: Foreground test isFromClient is false 694 * @tc.type: FUNC 695 */ 696 HWTEST_F(SessionProxyTest, Foreground03, Function | SmallTest | Level2) 697 { 698 GTEST_LOG_(INFO) << "SessionProxyTest: Foreground03 start"; 699 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 700 ASSERT_NE(sProxy, nullptr); 701 702 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr(); 703 ASSERT_NE(property, nullptr); 704 bool isFromClient = false; 705 std::string identityToken = "foregroundTest"; 706 WSError ret = sProxy->Foreground(property, isFromClient, identityToken); 707 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 708 GTEST_LOG_(INFO) << "SessionProxyTest: Foreground03 end"; 709 } 710 711 /** 712 * @tc.name: Background 713 * @tc.desc: Background test 714 * @tc.type: FUNC 715 */ 716 HWTEST_F(SessionProxyTest, Background, Function | SmallTest | Level2) 717 { 718 GTEST_LOG_(INFO) << "SessionProxyTest: Background start"; 719 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 720 ASSERT_NE(sProxy, nullptr); 721 722 bool isFromClient = true; 723 std::string identityToken = "backgroundTest"; 724 WSError ret = sProxy->Background(isFromClient, identityToken); 725 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 726 GTEST_LOG_(INFO) << "SessionProxyTest: Background end"; 727 } 728 729 /** 730 * @tc.name: Background02 731 * @tc.desc: Background test isFromClient is false 732 * @tc.type: FUNC 733 */ 734 HWTEST_F(SessionProxyTest, Background02, Function | SmallTest | Level2) 735 { 736 GTEST_LOG_(INFO) << "SessionProxyTest: Background02 start"; 737 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 738 ASSERT_NE(sProxy, nullptr); 739 740 bool isFromClient = false; 741 std::string identityToken = "backgroundTest"; 742 WSError ret = sProxy->Background(isFromClient, identityToken); 743 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 744 GTEST_LOG_(INFO) << "SessionProxyTest: Background02 end"; 745 } 746 747 /** 748 * @tc.name: Show 749 * @tc.desc: Show Test 750 * @tc.type: FUNC 751 */ 752 HWTEST_F(SessionProxyTest, Show, Function | SmallTest | Level2) 753 { 754 GTEST_LOG_(INFO) << "SessionProxyTest: Show start"; 755 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 756 ASSERT_NE(sProxy, nullptr); 757 758 sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr(); 759 WSError ret = sProxy->Show(property); 760 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 761 762 // property is nullptr 763 ret = sProxy->Show(nullptr); 764 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 765 GTEST_LOG_(INFO) << "SessionProxyTest: Show end"; 766 } 767 768 /** 769 * @tc.name: Hide 770 * @tc.desc: Hide Test 771 * @tc.type: FUNC 772 */ 773 HWTEST_F(SessionProxyTest, Hide, Function | SmallTest | Level2) 774 { 775 GTEST_LOG_(INFO) << "SessionProxyTest: Hide start"; 776 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 777 ASSERT_NE(sProxy, nullptr); 778 779 WSError ret = sProxy->Hide(); 780 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 781 GTEST_LOG_(INFO) << "SessionProxyTest: Hide end"; 782 } 783 784 /** 785 * @tc.name: Disconnect 786 * @tc.desc: Disconnect Test 787 * @tc.type: FUNC 788 */ 789 HWTEST_F(SessionProxyTest, Disconnect, Function | SmallTest | Level2) 790 { 791 GTEST_LOG_(INFO) << "SessionProxyTest: Disconnect start"; 792 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 793 ASSERT_NE(sProxy, nullptr); 794 795 bool isFromClient = true; 796 std::string identityToken = "disconnectTest"; 797 WSError ret = sProxy->Disconnect(isFromClient, identityToken); 798 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 799 800 // isFromClient is false 801 isFromClient = false; 802 ret = sProxy->Disconnect(isFromClient, identityToken); 803 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 804 GTEST_LOG_(INFO) << "SessionProxyTest: Disconnect end"; 805 } 806 807 /** 808 * @tc.name: DrawingCompleted 809 * @tc.desc: DrawingCompleted Test 810 * @tc.type: FUNC 811 */ 812 HWTEST_F(SessionProxyTest, DrawingCompleted, Function | SmallTest | Level2) 813 { 814 GTEST_LOG_(INFO) << "SessionProxyTest: DrawingCompleted start"; 815 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 816 ASSERT_NE(sProxy, nullptr); 817 818 WSError ret = sProxy->DrawingCompleted(); 819 ASSERT_EQ(ret, WSError::WS_ERROR_IPC_FAILED); 820 GTEST_LOG_(INFO) << "SessionProxyTest: DrawingCompleted end"; 821 } 822 823 /** 824 * @tc.name: NotifySupportWindowModesChange 825 * @tc.desc: normal function 826 * @tc.type: FUNC 827 */ 828 HWTEST_F(SessionProxyTest, NotifySupportWindowModesChange, Function | SmallTest | Level2) 829 { 830 GTEST_LOG_(INFO) << "SessionProxyTest: NotifySupportWindowModesChange start"; 831 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 832 ASSERT_NE(iRemoteObjectMocker, nullptr); 833 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 834 835 std::vector<AppExecFwk::SupportWindowMode> supportedWindowModes = { 836 AppExecFwk::SupportWindowMode::FULLSCREEN, 837 AppExecFwk::SupportWindowMode::SPLIT, 838 AppExecFwk::SupportWindowMode::FLOATING 839 }; 840 WSError res = sProxy->NotifySupportWindowModesChange(supportedWindowModes); 841 ASSERT_EQ(res, WSError::WS_OK); 842 GTEST_LOG_(INFO) << "SessionProxyTest: NotifySupportWindowModesChange end"; 843 } 844 845 /** 846 * @tc.name: GetIsMidScene 847 * @tc.desc: GetIsMidScene 848 * @tc.type: FUNC 849 */ 850 HWTEST_F(SessionProxyTest, GetIsMidScene, Function | SmallTest | Level2) 851 { 852 GTEST_LOG_(INFO) << "SessionProxyTest: GetIsMidScene start"; 853 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 854 855 bool isMidScene = false; 856 WSError res = sProxy->GetIsMidScene(isMidScene); 857 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 858 ASSERT_EQ(isMidScene, false); 859 GTEST_LOG_(INFO) << "SessionProxyTest: GetIsMidScene end"; 860 } 861 862 /** 863 * @tc.name: ChangeSessionVisibilityWithStatusBar 864 * @tc.desc: ChangeSessionVisibilityWithStatusBar test 865 * @tc.type: FUNC 866 */ 867 HWTEST_F(SessionProxyTest, ChangeSessionVisibilityWithStatusBar, Function | SmallTest | Level2) 868 { 869 GTEST_LOG_(INFO) << "SessionProxyTest: ChangeSessionVisibilityWithStatusBar start"; 870 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 871 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 872 873 bool visible = true; 874 sptr<AAFwk::SessionInfo> abilitySessionInfo = sptr<AAFwk::SessionInfo>::MakeSptr(); 875 WSError res = sProxy->ChangeSessionVisibilityWithStatusBar(abilitySessionInfo, visible); 876 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 877 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 878 res = sProxy->ChangeSessionVisibilityWithStatusBar(abilitySessionInfo, visible); 879 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 880 abilitySessionInfo = nullptr; 881 res = sProxy->ChangeSessionVisibilityWithStatusBar(abilitySessionInfo, visible); 882 ASSERT_EQ(res, WSError::WS_ERROR_INVALID_SESSION); 883 GTEST_LOG_(INFO) << "SessionProxyTest: ChangeSessionVisibilityWithStatusBar end"; 884 } 885 886 /** 887 * @tc.name: SyncSessionEvent 888 * @tc.desc: SyncSessionEvent test 889 * @tc.type: FUNC 890 */ 891 HWTEST_F(SessionProxyTest, SyncSessionEvent, Function | SmallTest | Level2) 892 { 893 GTEST_LOG_(INFO) << "SessionProxyTest: SyncSessionEvent start"; 894 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 895 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 896 897 SessionEvent event = SessionEvent::EVENT_MAXIMIZE; 898 WSError res = sProxy->SyncSessionEvent(event); 899 ASSERT_EQ(res, WSError::WS_OK); 900 GTEST_LOG_(INFO) << "SessionProxyTest: SyncSessionEvent end"; 901 } 902 903 /** 904 * @tc.name: OnLayoutFullScreenChange 905 * @tc.desc: OnLayoutFullScreenChange test 906 * @tc.type: FUNC 907 */ 908 HWTEST_F(SessionProxyTest, OnLayoutFullScreenChange, Function | SmallTest | Level2) 909 { 910 GTEST_LOG_(INFO) << "SessionProxyTest: OnLayoutFullScreenChange start"; 911 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 912 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 913 914 bool isLayoutFullScreen = true; 915 WSError res = sProxy->OnLayoutFullScreenChange(isLayoutFullScreen); 916 ASSERT_EQ(res, WSError::WS_OK); 917 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 918 res = sProxy->OnLayoutFullScreenChange(isLayoutFullScreen); 919 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 920 GTEST_LOG_(INFO) << "SessionProxyTest: OnLayoutFullScreenChange end"; 921 } 922 923 /** 924 * @tc.name: OnDefaultDensityEnabled 925 * @tc.desc: OnDefaultDensityEnabled test 926 * @tc.type: FUNC 927 */ 928 HWTEST_F(SessionProxyTest, OnDefaultDensityEnabled, Function | SmallTest | Level2) 929 { 930 GTEST_LOG_(INFO) << "SessionProxyTest: OnDefaultDensityEnabled start"; 931 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 932 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 933 934 bool isDefaultDensityEnabled = true; 935 WSError res = sProxy->OnDefaultDensityEnabled(isDefaultDensityEnabled); 936 ASSERT_EQ(res, WSError::WS_OK); 937 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 938 res = sProxy->OnDefaultDensityEnabled(isDefaultDensityEnabled); 939 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 940 GTEST_LOG_(INFO) << "SessionProxyTest: OnDefaultDensityEnabled end"; 941 } 942 943 /** 944 * @tc.name: NotifyFrameLayoutFinishFromApp 945 * @tc.desc: NotifyFrameLayoutFinishFromApp test 946 * @tc.type: FUNC 947 */ 948 HWTEST_F(SessionProxyTest, NotifyFrameLayoutFinishFromApp, Function | SmallTest | Level2) 949 { 950 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyFrameLayoutFinishFromApp start"; 951 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 952 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 953 954 bool notifyListener = true; 955 WSRect rect = { 200, 200, 200, 200 }; 956 WSError res = sProxy->NotifyFrameLayoutFinishFromApp(notifyListener, rect); 957 ASSERT_EQ(res, WSError::WS_OK); 958 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 959 res = sProxy->NotifyFrameLayoutFinishFromApp(notifyListener, rect); 960 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 961 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyFrameLayoutFinishFromApp end"; 962 } 963 964 /** 965 * @tc.name: RaiseAppMainWindowToTop 966 * @tc.desc: RaiseAppMainWindowToTop test 967 * @tc.type: FUNC 968 */ 969 HWTEST_F(SessionProxyTest, RaiseAppMainWindowToTop, Function | SmallTest | Level2) 970 { 971 GTEST_LOG_(INFO) << "SessionProxyTest: RaiseAppMainWindowToTop start"; 972 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 973 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 974 975 WSError res = sProxy->RaiseAppMainWindowToTop(); 976 ASSERT_EQ(res, WSError::WS_OK); 977 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 978 res = sProxy->RaiseAppMainWindowToTop(); 979 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 980 GTEST_LOG_(INFO) << "SessionProxyTest: RaiseAppMainWindowToTop end"; 981 } 982 983 /** 984 * @tc.name: GetAllAvoidAreas 985 * @tc.desc: GetAllAvoidAreas test 986 * @tc.type: FUNC 987 */ 988 HWTEST_F(SessionProxyTest, GetAllAvoidAreas, Function | SmallTest | Level2) 989 { 990 GTEST_LOG_(INFO) << "SessionProxyTest: GetAllAvoidAreas start"; 991 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 992 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 993 994 std::map<AvoidAreaType, AvoidArea> avoidAreas; 995 WSError res = sProxy->GetAllAvoidAreas(avoidAreas); 996 ASSERT_EQ(res, WSError::WS_OK); 997 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 998 res = sProxy->GetAllAvoidAreas(avoidAreas); 999 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1000 GTEST_LOG_(INFO) << "SessionProxyTest: GetAllAvoidAreas end"; 1001 } 1002 1003 /** 1004 * @tc.name: SetLandscapeMultiWindow 1005 * @tc.desc: SetLandscapeMultiWindow test 1006 * @tc.type: FUNC 1007 */ 1008 HWTEST_F(SessionProxyTest, SetLandscapeMultiWindow, Function | SmallTest | Level2) 1009 { 1010 GTEST_LOG_(INFO) << "SessionProxyTest: SetLandscapeMultiWindow start"; 1011 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1012 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1013 1014 bool isLandscapeMultiWindow = true; 1015 WSError res = sProxy->SetLandscapeMultiWindow(isLandscapeMultiWindow); 1016 ASSERT_EQ(res, WSError::WS_OK); 1017 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1018 res = sProxy->SetLandscapeMultiWindow(isLandscapeMultiWindow); 1019 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1020 GTEST_LOG_(INFO) << "SessionProxyTest: SetLandscapeMultiWindow end"; 1021 } 1022 1023 /** 1024 * @tc.name: NotifySyncOn 1025 * @tc.desc: NotifySyncOn test 1026 * @tc.type: FUNC 1027 */ 1028 HWTEST_F(SessionProxyTest, NotifySyncOn, Function | SmallTest | Level2) 1029 { 1030 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1031 ASSERT_NE(sProxy, nullptr); 1032 sProxy->NotifySyncOn(); 1033 1034 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1035 ASSERT_NE(iRemoteObjectMocker, nullptr); 1036 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1037 ASSERT_NE(sProxy, nullptr); 1038 sProxy->NotifySyncOn(); 1039 1040 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 1041 sProxy->NotifySyncOn(); 1042 MockMessageParcel::ClearAllErrorFlag(); 1043 } 1044 1045 /** 1046 * @tc.name: TriggerBindModalUIExtension 1047 * @tc.desc: TriggerBindModalUIExtension test 1048 * @tc.type: FUNC 1049 */ 1050 HWTEST_F(SessionProxyTest, TriggerBindModalUIExtension, Function | SmallTest | Level2) 1051 { 1052 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1053 ASSERT_NE(sProxy, nullptr); 1054 sProxy->TriggerBindModalUIExtension(); 1055 1056 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1057 ASSERT_NE(iRemoteObjectMocker, nullptr); 1058 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1059 ASSERT_NE(sProxy, nullptr); 1060 sProxy->TriggerBindModalUIExtension(); 1061 1062 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 1063 sProxy->TriggerBindModalUIExtension(); 1064 MockMessageParcel::ClearAllErrorFlag(); 1065 } 1066 1067 /** 1068 * @tc.name: NotifyPiPWindowPrepareClose 1069 * @tc.desc: NotifyPiPWindowPrepareClose test 1070 * @tc.type: FUNC 1071 */ 1072 HWTEST_F(SessionProxyTest, NotifyPiPWindowPrepareClose, Function | SmallTest | Level2) 1073 { 1074 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1075 ASSERT_NE(sProxy, nullptr); 1076 sProxy->NotifyPiPWindowPrepareClose(); 1077 1078 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1079 ASSERT_NE(iRemoteObjectMocker, nullptr); 1080 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1081 ASSERT_NE(sProxy, nullptr); 1082 sProxy->NotifyPiPWindowPrepareClose(); 1083 1084 MockMessageParcel::SetWriteInterfaceTokenErrorFlag(true); 1085 sProxy->NotifyPiPWindowPrepareClose(); 1086 MockMessageParcel::ClearAllErrorFlag(); 1087 } 1088 1089 /** 1090 * @tc.name: UpdatePiPRect 1091 * @tc.desc: UpdatePiPRect test 1092 * @tc.type: FUNC 1093 */ 1094 HWTEST_F(SessionProxyTest, UpdatePiPRect, Function | SmallTest | Level2) 1095 { 1096 GTEST_LOG_(INFO) << "SessionProxyTest: UpdatePiPRect start"; 1097 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1098 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1099 1100 Rect rect = { 200, 200, 200, 200 }; 1101 SizeChangeReason reason = SizeChangeReason::UNDEFINED; 1102 WSError res = sProxy->UpdatePiPRect(rect, reason); 1103 ASSERT_EQ(res, WSError::WS_OK); 1104 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1105 res = sProxy->UpdatePiPRect(rect, reason); 1106 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1107 GTEST_LOG_(INFO) << "SessionProxyTest: UpdatePiPRect end"; 1108 } 1109 1110 /** 1111 * @tc.name: SetSessionLabelAndIcon 1112 * @tc.desc: SetSessionLabelAndIcon 1113 * @tc.type: FUNC 1114 */ 1115 HWTEST_F(SessionProxyTest, SetSessionLabelAndIcon, Function | SmallTest | Level2) 1116 { 1117 std::string label = "SetSessionLabelAndIcon"; 1118 std::shared_ptr<Media::PixelMap> icon = std::make_shared<Media::PixelMap>(); 1119 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1120 1121 ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, sProxy->SetSessionLabelAndIcon(label, icon)); 1122 } 1123 1124 /** 1125 * @tc.name: SetWindowCornerRadius 1126 * @tc.desc: SetWindowCornerRadius 1127 * @tc.type: FUNC 1128 */ 1129 HWTEST_F(SessionProxyTest, SetWindowCornerRadius, Function | SmallTest | Level2) 1130 { 1131 GTEST_LOG_(INFO) << "SessionProxyTest: SetWindowCornerRadius start"; 1132 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1133 ASSERT_NE(iRemoteObjectMocker, nullptr); 1134 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1135 ASSERT_NE(sProxy, nullptr); 1136 WSError res = sProxy->SetWindowCornerRadius(1.0f); 1137 ASSERT_EQ(res, WSError::WS_OK); 1138 GTEST_LOG_(INFO) << "SessionProxyTest: SetWindowCornerRadius end"; 1139 } 1140 1141 /** 1142 * @tc.name: UpdateFlag 1143 * @tc.desc: UpdateFlag 1144 * @tc.type: FUNC 1145 */ 1146 HWTEST_F(SessionProxyTest, UpdateFlag, Function | SmallTest | Level2) 1147 { 1148 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateFlag start"; 1149 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1150 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1151 ASSERT_NE(sProxy, nullptr); 1152 std::string flag = "test"; 1153 WSError res = sProxy->UpdateFlag(flag); 1154 ASSERT_EQ(res, WSError::WS_OK); 1155 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateFlag end"; 1156 } 1157 1158 /** 1159 * @tc.name: ProcessPointDownSession 1160 * @tc.desc: ProcessPointDownSession test 1161 * @tc.type: FUNC 1162 */ 1163 HWTEST_F(SessionProxyTest, ProcessPointDownSession, Function | SmallTest | Level2) 1164 { 1165 GTEST_LOG_(INFO) << "SessionProxyTest: ProcessPointDownSession start"; 1166 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1167 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1168 1169 int32_t posX = 50; 1170 int32_t posY = 50; 1171 WSError res = sProxy->ProcessPointDownSession(posX, posY); 1172 ASSERT_EQ(res, WSError::WS_OK); 1173 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1174 res = sProxy->ProcessPointDownSession(posX, posY); 1175 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1176 GTEST_LOG_(INFO) << "SessionProxyTest: ProcessPointDownSession end"; 1177 } 1178 1179 /** 1180 * @tc.name: SendPointEventForMoveDrag 1181 * @tc.desc: SendPointEventForMoveDrag test 1182 * @tc.type: FUNC 1183 */ 1184 HWTEST_F(SessionProxyTest, SendPointEventForMoveDrag, Function | SmallTest | Level2) 1185 { 1186 GTEST_LOG_(INFO) << "SessionProxyTest: SendPointEventForMoveDrag start"; 1187 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1188 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1189 1190 std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create(); 1191 bool isExecuteDelayRaise = true; 1192 WSError res = sProxy->SendPointEventForMoveDrag(pointerEvent, isExecuteDelayRaise); 1193 ASSERT_EQ(res, WSError::WS_OK); 1194 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1195 res = sProxy->SendPointEventForMoveDrag(pointerEvent, isExecuteDelayRaise); 1196 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1197 GTEST_LOG_(INFO) << "SessionProxyTest: SendPointEventForMoveDrag end"; 1198 } 1199 1200 /** 1201 * @tc.name: IsStartMoving 1202 * @tc.desc: IsStartMoving test 1203 * @tc.type: FUNC 1204 */ 1205 HWTEST_F(SessionProxyTest, IsStartMoving, Function | SmallTest | Level2) 1206 { 1207 GTEST_LOG_(INFO) << "SessionProxyTest: IsStartMoving start"; 1208 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1209 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1210 1211 bool res = sProxy->IsStartMoving(); 1212 ASSERT_EQ(res, false); 1213 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1214 res = sProxy->IsStartMoving(); 1215 ASSERT_EQ(res, false); 1216 GTEST_LOG_(INFO) << "SessionProxyTest: IsStartMoving end"; 1217 } 1218 1219 /** 1220 * @tc.name: UpdateRectChangeListenerRegistered 1221 * @tc.desc: UpdateRectChangeListenerRegistered test 1222 * @tc.type: FUNC 1223 */ 1224 HWTEST_F(SessionProxyTest, UpdateRectChangeListenerRegistered, Function | SmallTest | Level2) 1225 { 1226 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateRectChangeListenerRegistered start"; 1227 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1228 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1229 1230 bool isRegister = true; 1231 WSError res = sProxy->UpdateRectChangeListenerRegistered(isRegister); 1232 ASSERT_EQ(res, WSError::WS_OK); 1233 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1234 res = sProxy->UpdateRectChangeListenerRegistered(isRegister); 1235 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1236 GTEST_LOG_(INFO) << "SessionProxyTest: UpdateRectChangeListenerRegistered end"; 1237 } 1238 1239 /** 1240 * @tc.name: SendExtensionData 1241 * @tc.desc: SendExtensionData test 1242 * @tc.type: FUNC 1243 */ 1244 HWTEST_F(SessionProxyTest, SendExtensionData, Function | SmallTest | Level2) 1245 { 1246 GTEST_LOG_(INFO) << "SessionProxyTest: SendExtensionData start"; 1247 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1248 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1249 1250 MessageParcel data; 1251 MessageParcel reply; 1252 MessageOption option(MessageOption::TF_SYNC); 1253 WSError res = sProxy->SendExtensionData(data, reply, option); 1254 ASSERT_EQ(res, WSError::WS_OK); 1255 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1256 res = sProxy->SendExtensionData(data, reply, option); 1257 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1258 GTEST_LOG_(INFO) << "SessionProxyTest: SendExtensionData end"; 1259 } 1260 1261 /** 1262 * @tc.name: SetGestureBackEnabled 1263 * @tc.desc: SetGestureBackEnabled test 1264 * @tc.type: FUNC 1265 */ 1266 HWTEST_F(SessionProxyTest, SetGestureBackEnabled, Function | SmallTest | Level2) 1267 { 1268 GTEST_LOG_(INFO) << "SessionProxyTest: SetGestureBackEnabled start"; 1269 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1270 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1271 1272 bool isEnabled = true; 1273 WMError res = sProxy->SetGestureBackEnabled(isEnabled); 1274 ASSERT_EQ(res, WMError::WM_OK); 1275 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1276 res = sProxy->SetGestureBackEnabled(isEnabled); 1277 ASSERT_EQ(res, WMError::WM_ERROR_IPC_FAILED); 1278 GTEST_LOG_(INFO) << "SessionProxyTest: SetGestureBackEnabled end"; 1279 } 1280 1281 /** 1282 * @tc.name: NotifySubModalTypeChange 1283 * @tc.desc: NotifySubModalTypeChange test 1284 * @tc.type: FUNC 1285 */ 1286 HWTEST_F(SessionProxyTest, NotifySubModalTypeChange, Function | SmallTest | Level2) 1287 { 1288 GTEST_LOG_(INFO) << "SessionProxyTest: NotifySubModalTypeChange start"; 1289 sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1290 sptr<SessionProxy> sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1291 1292 SubWindowModalType subWindowModalType = SubWindowModalType::TYPE_APPLICATION_MODALITY; 1293 WSError res = sProxy->NotifySubModalTypeChange(subWindowModalType); 1294 ASSERT_EQ(res, WSError::WS_OK); 1295 sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1296 res = sProxy->NotifySubModalTypeChange(subWindowModalType); 1297 ASSERT_EQ(res, WSError::WS_ERROR_IPC_FAILED); 1298 GTEST_LOG_(INFO) << "SessionProxyTest: NotifySubModalTypeChange end"; 1299 } 1300 1301 /** 1302 * @tc.name: GetCrossAxisState 1303 * @tc.desc: normal function 1304 * @tc.type: FUNC 1305 */ 1306 HWTEST_F(SessionProxyTest, GetCrossAxisState, Function | SmallTest | Level2) 1307 { 1308 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1309 ASSERT_NE(iRemoteObjectMocker, nullptr); 1310 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1311 ASSERT_NE(sProxy, nullptr); 1312 CrossAxisState state = CrossAxisState::STATE_CROSS; 1313 WSError res = sProxy->GetCrossAxisState(state); 1314 ASSERT_EQ(res, WSError::WS_OK); 1315 } 1316 1317 /** 1318 * @tc.name: OnContainerModalEvent 1319 * @tc.desc: OnContainerModalEvent Test 1320 * @tc.type: FUNC 1321 */ 1322 HWTEST_F(SessionProxyTest, OnContainerModalEvent, Function | SmallTest | Level2) 1323 { 1324 GTEST_LOG_(INFO) << "SessionProxyTest: OnContainerModalEvent start"; 1325 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1326 ASSERT_NE(iRemoteObjectMocker, nullptr); 1327 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1328 ASSERT_NE(sProxy, nullptr); 1329 WSError res = sProxy->OnContainerModalEvent("name", "value"); 1330 ASSERT_EQ(res, WSError::WS_OK); 1331 GTEST_LOG_(INFO) << "SessionProxyTest: OnContainerModalEvent end"; 1332 } 1333 1334 /** 1335 * @tc.name: NotifyFollowParentMultiScreenPolicy 1336 * @tc.desc: NotifyFollowParentMultiScreenPolicy test 1337 * @tc.type: FUNC 1338 */ 1339 HWTEST_F(SessionProxyTest, NotifyFollowParentMultiScreenPolicy, Function | SmallTest | Level2) 1340 { 1341 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyFollowParentMultiScreenPolicy start"; 1342 auto sProxy = sptr<SessionProxy>::MakeSptr(nullptr); 1343 ASSERT_EQ(sProxy->NotifyFollowParentMultiScreenPolicy(true), WSError::WS_ERROR_IPC_FAILED); 1344 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1345 sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1346 ASSERT_EQ(sProxy->NotifyFollowParentMultiScreenPolicy(true), WSError::WS_OK); 1347 GTEST_LOG_(INFO) << "SessionProxyTest: NotifyFollowParentMultiScreenPolicy end"; 1348 } 1349 1350 /** 1351 * @tc.name: GetIsHighlighted 1352 * @tc.desc: GetIsHighlighted test 1353 * @tc.type: FUNC 1354 */ 1355 HWTEST_F(SessionProxyTest, GetIsHighlighted, Function | SmallTest | Level2) 1356 { 1357 auto iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr(); 1358 ASSERT_NE(iRemoteObjectMocker, nullptr); 1359 auto sProxy = sptr<SessionProxy>::MakeSptr(iRemoteObjectMocker); 1360 ASSERT_NE(sProxy, nullptr); 1361 bool isHighlighted = false; 1362 ASSERT_EQ(sProxy->GetIsHighlighted(isHighlighted), WSError::WS_ERROR_IPC_FAILED); 1363 } 1364 } // namespace 1365 } // namespace Rosen 1366 } // namespace OHOS