Update test/ to not use implicit conversion from scoped_refptr<T> to T*.

Bug: webrtc:13464
Change-Id: I55750dc842adf0d854bbc45e593c0e251064f9d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259771
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36623}
diff --git a/test/fake_decoder.cc b/test/fake_decoder.cc
index 2cb2aa2..72783bc 100644
--- a/test/fake_decoder.cc
+++ b/test/fake_decoder.cc
@@ -49,7 +49,7 @@
   }
 
   rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
-  I420Buffer::SetBlack(buffer);
+  I420Buffer::SetBlack(buffer.get());
   VideoFrame frame = VideoFrame::Builder()
                          .set_video_frame_buffer(buffer)
                          .set_rotation(webrtc::kVideoRotation_0)
diff --git a/test/fake_texture_frame.cc b/test/fake_texture_frame.cc
index 3f15518..b1269b4 100644
--- a/test/fake_texture_frame.cc
+++ b/test/fake_texture_frame.cc
@@ -44,7 +44,7 @@
 
 rtc::scoped_refptr<I420BufferInterface> FakeNativeBuffer::ToI420() {
   rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(width_, height_);
-  I420Buffer::SetBlack(buffer);
+  I420Buffer::SetBlack(buffer.get());
   return buffer;
 }
 
diff --git a/test/mappable_native_buffer.cc b/test/mappable_native_buffer.cc
index 48b9379..1b171e6 100644
--- a/test/mappable_native_buffer.cc
+++ b/test/mappable_native_buffer.cc
@@ -163,7 +163,7 @@
     case VideoFrameBuffer::Type::kI420: {
       rtc::scoped_refptr<I420Buffer> i420_buffer =
           I420Buffer::Create(width, height);
-      I420Buffer::SetBlack(i420_buffer);
+      I420Buffer::SetBlack(i420_buffer.get());
       mapped_buffer = i420_buffer;
       break;
     }
diff --git a/test/network/network_emulation_pc_unittest.cc b/test/network/network_emulation_pc_unittest.cc
index bd15b5a..cb446b4 100644
--- a/test/network/network_emulation_pc_unittest.cc
+++ b/test/network/network_emulation_pc_unittest.cc
@@ -167,7 +167,7 @@
     rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
         alice_pcf->CreateAudioSource(cricket::AudioOptions());
     rtc::scoped_refptr<AudioTrackInterface> track =
-        alice_pcf->CreateAudioTrack("audio", source);
+        alice_pcf->CreateAudioTrack("audio", source.get());
     alice->AddTransceiver(track);
 
     // Connect peers.
@@ -276,7 +276,7 @@
     rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
         alice_pcf->CreateAudioSource(cricket::AudioOptions());
     rtc::scoped_refptr<AudioTrackInterface> track =
-        alice_pcf->CreateAudioTrack("audio", source);
+        alice_pcf->CreateAudioTrack("audio", source.get());
     alice->AddTransceiver(track);
 
     // Connect peers.
diff --git a/test/pc/e2e/media/media_helper.cc b/test/pc/e2e/media/media_helper.cc
index c90b2e5..7985bd0 100644
--- a/test/pc/e2e/media/media_helper.cc
+++ b/test/pc/e2e/media/media_helper.cc
@@ -40,7 +40,8 @@
   rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
       peer->pc_factory()->CreateAudioSource(audio_config.audio_options);
   rtc::scoped_refptr<AudioTrackInterface> track =
-      peer->pc_factory()->CreateAudioTrack(*audio_config.stream_label, source);
+      peer->pc_factory()->CreateAudioTrack(*audio_config.stream_label,
+                                           source.get());
   std::string sync_group = audio_config.sync_group
                                ? audio_config.sync_group.value()
                                : audio_config.stream_label.value();
@@ -71,7 +72,7 @@
                      << video_config.stream_label.value();
     rtc::scoped_refptr<VideoTrackInterface> track =
         peer->pc_factory()->CreateVideoTrack(video_config.stream_label.value(),
-                                             source);
+                                             source.get());
     if (video_config.content_hint.has_value()) {
       track->set_content_hint(video_config.content_hint.value());
     }
diff --git a/test/peer_scenario/peer_scenario_client.cc b/test/peer_scenario/peer_scenario_client.cc
index 2767de2..7e1720c 100644
--- a/test/peer_scenario/peer_scenario_client.cc
+++ b/test/peer_scenario/peer_scenario_client.cc
@@ -306,7 +306,7 @@
   RTC_DCHECK_RUN_ON(signaling_thread_);
   AudioSendTrack res;
   auto source = pc_factory_->CreateAudioSource(options);
-  auto track = pc_factory_->CreateAudioTrack(track_id, source);
+  auto track = pc_factory_->CreateAudioTrack(track_id, source.get());
   res.track = track;
   res.sender = peer_connection_->AddTrack(track, {kCommonStreamId}).value();
   return res;
@@ -323,9 +323,10 @@
   capturer->Init();
   res.source = rtc::make_ref_counted<FrameGeneratorCapturerVideoTrackSource>(
       std::move(capturer), config.screencast);
-  auto track = pc_factory_->CreateVideoTrack(track_id, res.source);
-  res.track = track;
-  res.sender = peer_connection_->AddTrack(track, {kCommonStreamId}).MoveValue();
+  auto track = pc_factory_->CreateVideoTrack(track_id, res.source.get());
+  res.track = track.get();
+  res.sender =
+      peer_connection_->AddTrack(track, {kCommonStreamId}).MoveValue().get();
   return res;
 }
 
@@ -355,7 +356,8 @@
                     [sdp_offer, offer_handler](RTCError) {
                       offer_handler(sdp_offer);
                     }));
-          }),
+          })
+          .get(),
       PeerConnectionInterface::RTCOfferAnswerOptions());
 }
 
@@ -385,7 +387,8 @@
                           [answer_handler, sdp_answer](RTCError) {
                             answer_handler(sdp_answer);
                           }));
-                }),
+                })
+                .get(),
             PeerConnectionInterface::RTCOfferAnswerOptions());
       }));
 }
diff --git a/test/peer_scenario/tests/peer_scenario_quality_test.cc b/test/peer_scenario/tests/peer_scenario_quality_test.cc
index 5d69a09..911a687 100644
--- a/test/peer_scenario/tests/peer_scenario_quality_test.cc
+++ b/test/peer_scenario/tests/peer_scenario_quality_test.cc
@@ -29,7 +29,7 @@
     video_conf.generator.squares_video->framerate = 20;
     auto video = caller->CreateVideo("VIDEO", video_conf);
     auto link_builder = s.net()->NodeBuilder().delay_ms(100).capacity_kbps(600);
-    s.AttachVideoQualityAnalyzer(&analyzer, video.track, callee);
+    s.AttachVideoQualityAnalyzer(&analyzer, video.track.get(), callee);
     s.SimpleConnection(caller, callee, {link_builder.Build().node},
                        {link_builder.Build().node});
     s.ProcessMessages(TimeDelta::Seconds(2));
diff --git a/test/win/d3d_renderer.cc b/test/win/d3d_renderer.cc
index 64b7184..5ba90fa 100644
--- a/test/win/d3d_renderer.cc
+++ b/test/win/d3d_renderer.cc
@@ -194,8 +194,9 @@
 
   d3d_device_->BeginScene();
   d3d_device_->SetFVF(D3DFVF_CUSTOMVERTEX);
-  d3d_device_->SetStreamSource(0, vertex_buffer_, 0, sizeof(D3dCustomVertex));
-  d3d_device_->SetTexture(0, texture_);
+  d3d_device_->SetStreamSource(0, vertex_buffer_.get(), 0,
+                               sizeof(D3dCustomVertex));
+  d3d_device_->SetTexture(0, texture_.get());
   d3d_device_->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
   d3d_device_->EndScene();