Failing test for unmuting microphone
This commit is contained in:
parent
844d161c40
commit
8669b08161
3 changed files with 45 additions and 13 deletions
|
@ -173,7 +173,11 @@ impl Room {
|
||||||
cx.spawn(|this, mut cx| async move {
|
cx.spawn(|this, mut cx| async move {
|
||||||
connect.await?;
|
connect.await?;
|
||||||
|
|
||||||
if !cx.update(|cx| Self::mute_on_join(cx))? {
|
let is_read_only = this
|
||||||
|
.update(&mut cx, |room, _| room.read_only())
|
||||||
|
.unwrap_or(true);
|
||||||
|
|
||||||
|
if !cx.update(|cx| Self::mute_on_join(cx))? && !is_read_only {
|
||||||
this.update(&mut cx, |this, cx| this.share_microphone(cx))?
|
this.update(&mut cx, |this, cx| this.share_microphone(cx))?
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ use call::ActiveCall;
|
||||||
use editor::Editor;
|
use editor::Editor;
|
||||||
use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext};
|
use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext};
|
||||||
use rpc::proto;
|
use rpc::proto;
|
||||||
use workspace::Workspace;
|
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_channel_guests(
|
async fn test_channel_guests(
|
||||||
|
@ -44,6 +43,8 @@ async fn test_channel_guests(
|
||||||
let active_call_b = cx_b.read(ActiveCall::global);
|
let active_call_b = cx_b.read(ActiveCall::global);
|
||||||
let project_b =
|
let project_b =
|
||||||
active_call_b.read_with(cx_b, |call, _| call.location().unwrap().upgrade().unwrap());
|
active_call_b.read_with(cx_b, |call, _| call.location().unwrap().upgrade().unwrap());
|
||||||
|
let room_b = active_call_b.update(cx_b, |call, _| call.room().unwrap().clone());
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
project_b.read_with(cx_b, |project, _| project.remote_id()),
|
project_b.read_with(cx_b, |project, _| project.remote_id()),
|
||||||
Some(project_id),
|
Some(project_id),
|
||||||
|
@ -55,7 +56,8 @@ async fn test_channel_guests(
|
||||||
project.create_entry((worktree_id, "b.txt"), false, cx)
|
project.create_entry((worktree_id, "b.txt"), false, cx)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.is_err())
|
.is_err());
|
||||||
|
assert!(room_b.read_with(cx_b, |room, _| !room.is_sharing_mic()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
|
@ -64,7 +66,6 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
||||||
let client_a = server.create_client(cx_a, "user_a").await;
|
let client_a = server.create_client(cx_a, "user_a").await;
|
||||||
let client_b = server.create_client(cx_b, "user_b").await;
|
let client_b = server.create_client(cx_b, "user_b").await;
|
||||||
let active_call_a = cx_a.read(ActiveCall::global);
|
let active_call_a = cx_a.read(ActiveCall::global);
|
||||||
let active_call_b = cx_b.read(ActiveCall::global);
|
|
||||||
|
|
||||||
let channel_id = server
|
let channel_id = server
|
||||||
.make_public_channel("the-channel", &client_a, cx_a)
|
.make_public_channel("the-channel", &client_a, cx_a)
|
||||||
|
@ -76,7 +77,7 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Client A shares a project in the channel
|
// Client A shares a project in the channel
|
||||||
let project_id = active_call_a
|
active_call_a
|
||||||
.update(cx_a, |call, cx| call.share_project(project_a.clone(), cx))
|
.update(cx_a, |call, cx| call.share_project(project_a.clone(), cx))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -88,14 +89,29 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
||||||
.unwrap();
|
.unwrap();
|
||||||
cx_a.run_until_parked();
|
cx_a.run_until_parked();
|
||||||
|
|
||||||
let project_b =
|
// client B opens 1.txt as a guest
|
||||||
active_call_b.read_with(cx_b, |call, _| call.location().unwrap().upgrade().unwrap());
|
let (workspace_b, cx_b) = client_b.active_workspace(cx_b);
|
||||||
|
let room_b = cx_b
|
||||||
// client B opens 1.txt
|
.read(ActiveCall::global)
|
||||||
let (workspace, cx_b) = client_b.active_workspace(cx_b);
|
.update(cx_b, |call, _| call.room().unwrap().clone());
|
||||||
cx_b.simulate_keystrokes("cmd-p 1 enter");
|
cx_b.simulate_keystrokes("cmd-p 1 enter");
|
||||||
let editor_b = cx_b.update(|cx| workspace.read(cx).active_item_as::<Editor>(cx).unwrap());
|
|
||||||
|
|
||||||
|
let (project_b, editor_b) = workspace_b.update(cx_b, |workspace, cx| {
|
||||||
|
(
|
||||||
|
workspace.project().clone(),
|
||||||
|
workspace.active_item_as::<Editor>(cx).unwrap(),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
assert!(project_b.read_with(cx_b, |project, _| project.is_read_only()));
|
||||||
|
assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
|
||||||
|
assert!(dbg!(
|
||||||
|
room_b
|
||||||
|
.update(cx_b, |room, cx| room.share_microphone(cx))
|
||||||
|
.await
|
||||||
|
)
|
||||||
|
.is_err());
|
||||||
|
|
||||||
|
// B is promoted
|
||||||
active_call_a
|
active_call_a
|
||||||
.update(cx_a, |call, cx| {
|
.update(cx_a, |call, cx| {
|
||||||
call.room().unwrap().update(cx, |room, cx| {
|
call.room().unwrap().update(cx, |room, cx| {
|
||||||
|
@ -108,9 +124,13 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
cx_a.run_until_parked();
|
cx_a.run_until_parked();
|
||||||
|
|
||||||
|
// project and buffers are now editable
|
||||||
assert!(project_b.read_with(cx_b, |project, _| !project.is_read_only()));
|
assert!(project_b.read_with(cx_b, |project, _| !project.is_read_only()));
|
||||||
assert!(!editor_b.update(cx_b, |e, cx| e.read_only(cx)));
|
assert!(editor_b.update(cx_b, |editor, cx| !editor.read_only(cx)));
|
||||||
|
room_b
|
||||||
|
.update(cx_b, |room, cx| room.share_microphone(cx))
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,10 @@ impl TestServer {
|
||||||
let identity = claims.sub.unwrap().to_string();
|
let identity = claims.sub.unwrap().to_string();
|
||||||
let room_name = claims.video.room.unwrap();
|
let room_name = claims.video.room.unwrap();
|
||||||
|
|
||||||
|
if claims.video.can_publish == Some(false) {
|
||||||
|
return Err(anyhow!("user is not allowed to publish"));
|
||||||
|
}
|
||||||
|
|
||||||
let mut server_rooms = self.rooms.lock();
|
let mut server_rooms = self.rooms.lock();
|
||||||
let room = server_rooms
|
let room = server_rooms
|
||||||
.get_mut(&*room_name)
|
.get_mut(&*room_name)
|
||||||
|
@ -205,6 +209,10 @@ impl TestServer {
|
||||||
let identity = claims.sub.unwrap().to_string();
|
let identity = claims.sub.unwrap().to_string();
|
||||||
let room_name = claims.video.room.unwrap();
|
let room_name = claims.video.room.unwrap();
|
||||||
|
|
||||||
|
if claims.video.can_publish == Some(false) {
|
||||||
|
return Err(anyhow!("user is not allowed to publish"));
|
||||||
|
}
|
||||||
|
|
||||||
let mut server_rooms = self.rooms.lock();
|
let mut server_rooms = self.rooms.lock();
|
||||||
let room = server_rooms
|
let room = server_rooms
|
||||||
.get_mut(&*room_name)
|
.get_mut(&*room_name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue