File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
main/java/com/vaadin/flow/component/internal
test/java/com/vaadin/flow/server/communication Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -620,6 +620,7 @@ public void addJavaScriptInvocation(
620620 * @return a list of pending JavaScript invocations
621621 */
622622 public List <PendingJavaScriptInvocation > dumpPendingJavaScriptInvocations () {
623+ session .checkHasLock ();
623624 pendingTitleUpdateCanceler = null ;
624625
625626 if (pendingJsInvocations .isEmpty ()) {
@@ -677,6 +678,7 @@ public void execute() {
677678
678679 private void removePendingInvocation (
679680 PendingJavaScriptInvocation invocation ) {
681+ session .checkHasLock ();
680682 UIInternals .this .pendingJsInvocations .remove (invocation );
681683 if (invocationList .isEmpty () && registration != null ) {
682684 registration .remove ();
@@ -699,6 +701,7 @@ void onInvocationCompleted(PendingJavaScriptInvocation invocation) {
699701 */
700702 // Non-private for testing purposes
701703 Stream <PendingJavaScriptInvocation > getPendingJavaScriptInvocations () {
704+ session .checkHasLock ();
702705 return pendingJsInvocations .stream ()
703706 .filter (invocation -> !invocation .isCanceled ());
704707 }
Original file line number Diff line number Diff line change 4242import com .vaadin .flow .component .UI ;
4343import com .vaadin .flow .server .MockVaadinSession ;
4444import com .vaadin .flow .server .communication .AtmospherePushConnection .State ;
45+ import com .vaadin .tests .util .MockUI ;
4546
4647/**
4748 * @author Vaadin Ltd
@@ -67,9 +68,10 @@ public static void stopExecutor() {
6768
6869 @ Before
6970 public void setup () throws Exception {
70- UI ui = Mockito .spy (new UI ());
7171 vaadinSession = new MockVaadinSession ();
72- Mockito .when (ui .getSession ()).thenReturn (vaadinSession );
72+ vaadinSession .lock ();
73+ UI ui = new MockUI (vaadinSession );
74+ vaadinSession .unlock ();
7375 broadcaster = Mockito .mock (Broadcaster .class );
7476 resource = Mockito .mock (AtmosphereResource .class );
7577 Mockito .when (resource .getBroadcaster ()).thenReturn (broadcaster );
You can’t perform that action at this time.
0 commit comments