diff options
author | sergeyu <sergeyu@chromium.org> | 2015-12-23 16:20:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-24 00:22:13 +0000 |
commit | 42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a (patch) | |
tree | 5d69f8f65e9c3b096bb03f0256b155c745925bed /remoting/test | |
parent | 2e53cb5448df90f11940a2e55ef6c74bd74ac3e7 (diff) | |
download | chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.zip chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.tar.gz chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.tar.bz2 |
Use std::move() instead of .Pass() in remoting/*
Now there is a presubmit check that doesn't allow Pass() anymore.
See https://www.chromium.org/rvalue-references for information
about std::move in chromium.
Review URL: https://codereview.chromium.org/1545723002
Cr-Commit-Position: refs/heads/master@{#366778}
Diffstat (limited to 'remoting/test')
-rw-r--r-- | remoting/test/app_remoting_connected_client_fixture.cc | 10 | ||||
-rw-r--r-- | remoting/test/app_remoting_connection_helper.cc | 4 | ||||
-rw-r--r-- | remoting/test/app_remoting_latency_test_fixture.cc | 9 | ||||
-rw-r--r-- | remoting/test/app_remoting_test_driver_environment_unittest.cc | 3 | ||||
-rw-r--r-- | remoting/test/mock_access_token_fetcher.cc | 11 | ||||
-rw-r--r-- | remoting/test/protocol_perftest.cc | 30 | ||||
-rw-r--r-- | remoting/test/test_chromoting_client.cc | 22 | ||||
-rw-r--r-- | remoting/test/test_video_renderer_unittest.cc | 16 |
8 files changed, 52 insertions, 53 deletions
diff --git a/remoting/test/app_remoting_connected_client_fixture.cc b/remoting/test/app_remoting_connected_client_fixture.cc index 3660fb4..71ceae6 100644 --- a/remoting/test/app_remoting_connected_client_fixture.cc +++ b/remoting/test/app_remoting_connected_client_fixture.cc @@ -4,6 +4,8 @@ #include "remoting/test/app_remoting_connected_client_fixture.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/json/json_reader.h" #include "base/logging.h" @@ -39,11 +41,9 @@ namespace test { AppRemotingConnectedClientFixture::AppRemotingConnectedClientFixture() : application_details_( AppRemotingSharedData->GetDetailsFromAppName(GetParam())), - timer_(new base::Timer(true, false)) { -} + timer_(new base::Timer(true, false)) {} -AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() { -} +AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() {} void AppRemotingConnectedClientFixture::SetUp() { connection_helper_.reset( @@ -53,7 +53,7 @@ void AppRemotingConnectedClientFixture::SetUp() { test_chromoting_client->AddRemoteConnectionObserver(this); - connection_helper_->Initialize(test_chromoting_client.Pass()); + connection_helper_->Initialize(std::move(test_chromoting_client)); if (!connection_helper_->StartConnection()) { LOG(ERROR) << "Remote host connection could not be established."; FAIL(); diff --git a/remoting/test/app_remoting_connection_helper.cc b/remoting/test/app_remoting_connection_helper.cc index f39b398..215a1a2 100644 --- a/remoting/test/app_remoting_connection_helper.cc +++ b/remoting/test/app_remoting_connection_helper.cc @@ -4,6 +4,8 @@ #include "remoting/test/app_remoting_connection_helper.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/logging.h" #include "base/run_loop.h" @@ -46,7 +48,7 @@ AppRemotingConnectionHelper::~AppRemotingConnectionHelper() { void AppRemotingConnectionHelper::Initialize( scoped_ptr<TestChromotingClient> test_chromoting_client) { - client_ = test_chromoting_client.Pass(); + client_ = std::move(test_chromoting_client); client_->AddRemoteConnectionObserver(this); } diff --git a/remoting/test/app_remoting_latency_test_fixture.cc b/remoting/test/app_remoting_latency_test_fixture.cc index e8692ef..7be94d1 100644 --- a/remoting/test/app_remoting_latency_test_fixture.cc +++ b/remoting/test/app_remoting_latency_test_fixture.cc @@ -4,6 +4,8 @@ #include "remoting/test/app_remoting_latency_test_fixture.h" +#include <utility> + #include "base/logging.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" @@ -24,21 +26,20 @@ AppRemotingLatencyTestFixture::AppRemotingLatencyTestFixture() // NOTE: Derived fixture must initialize application details in constructor. } -AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() { -} +AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() {} void AppRemotingLatencyTestFixture::SetUp() { scoped_ptr<TestVideoRenderer> test_video_renderer(new TestVideoRenderer()); test_video_renderer_ = test_video_renderer->GetWeakPtr(); scoped_ptr<TestChromotingClient> test_chromoting_client( - new TestChromotingClient(test_video_renderer.Pass())); + new TestChromotingClient(std::move(test_video_renderer))); test_chromoting_client->AddRemoteConnectionObserver(this); connection_helper_.reset( new AppRemotingConnectionHelper(GetApplicationDetails())); - connection_helper_->Initialize(test_chromoting_client.Pass()); + connection_helper_->Initialize(std::move(test_chromoting_client)); if (!connection_helper_->StartConnection()) { LOG(ERROR) << "Remote host connection could not be established."; diff --git a/remoting/test/app_remoting_test_driver_environment_unittest.cc b/remoting/test/app_remoting_test_driver_environment_unittest.cc index 3efe396..26546b3 100644 --- a/remoting/test/app_remoting_test_driver_environment_unittest.cc +++ b/remoting/test/app_remoting_test_driver_environment_unittest.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include <algorithm> +#include <utility> #include "base/files/file_path.h" #include "base/macros.h" @@ -83,7 +84,7 @@ void AppRemotingTestDriverEnvironmentTest::Initialize( new FakeAccessTokenFetcher()); fake_access_token_fetcher_ = fake_access_token_fetcher.get(); mock_access_token_fetcher_.SetAccessTokenFetcher( - fake_access_token_fetcher.Pass()); + std::move(fake_access_token_fetcher)); environment_object_->SetAccessTokenFetcherForTest( &mock_access_token_fetcher_); diff --git a/remoting/test/mock_access_token_fetcher.cc b/remoting/test/mock_access_token_fetcher.cc index d5d5201..398f09f 100644 --- a/remoting/test/mock_access_token_fetcher.cc +++ b/remoting/test/mock_access_token_fetcher.cc @@ -4,21 +4,20 @@ #include "remoting/test/mock_access_token_fetcher.h" +#include <utility> + namespace remoting { namespace test { using ::testing::_; using ::testing::Invoke; -MockAccessTokenFetcher::MockAccessTokenFetcher() { -} - -MockAccessTokenFetcher::~MockAccessTokenFetcher() { -} +MockAccessTokenFetcher::MockAccessTokenFetcher() {} +MockAccessTokenFetcher::~MockAccessTokenFetcher() {} void MockAccessTokenFetcher::SetAccessTokenFetcher( scoped_ptr<AccessTokenFetcher> fetcher) { - internal_access_token_fetcher_ = fetcher.Pass(); + internal_access_token_fetcher_ = std::move(fetcher); ON_CALL(*this, GetAccessTokenFromAuthCode(_, _)) .WillByDefault(Invoke(internal_access_token_fetcher_.get(), diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index 86cb161..04703db 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/base64.h" #include "base/files/file_util.h" #include "base/macros.h" @@ -132,7 +134,7 @@ class ProtocolPerfTest return; } - last_video_packet_ = video_packet.Pass(); + last_video_packet_ = std::move(video_packet); if (!on_frame_task_.is_null()) on_frame_task_.Run(); @@ -236,7 +238,7 @@ class ProtocolPerfTest GetParam().out_of_order_rate); scoped_refptr<protocol::TransportContext> transport_context( new protocol::TransportContext( - host_signaling_.get(), port_allocator_factory.Pass(), + host_signaling_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::SERVER)); scoped_ptr<protocol::SessionManager> session_manager( @@ -248,14 +250,11 @@ class ProtocolPerfTest // Encoder runs on a separate thread, main thread is used for everything // else. - host_.reset(new ChromotingHost(&desktop_environment_factory_, - session_manager.Pass(), - host_thread_.task_runner(), - host_thread_.task_runner(), - capture_thread_.task_runner(), - encode_thread_.task_runner(), - host_thread_.task_runner(), - host_thread_.task_runner())); + host_.reset(new ChromotingHost( + &desktop_environment_factory_, std::move(session_manager), + host_thread_.task_runner(), host_thread_.task_runner(), + capture_thread_.task_runner(), encode_thread_.task_runner(), + host_thread_.task_runner(), host_thread_.task_runner())); base::FilePath certs_dir(net::GetTestCertsDirectory()); @@ -277,7 +276,7 @@ class ProtocolPerfTest scoped_ptr<protocol::AuthenticatorFactory> auth_factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( true, kHostOwner, host_cert, key_pair, host_secret, nullptr); - host_->SetAuthenticatorFactory(auth_factory.Pass()); + host_->SetAuthenticatorFactory(std::move(auth_factory)); host_->AddStatusObserver(this); host_->Start(kHostOwner); @@ -307,7 +306,7 @@ class ProtocolPerfTest GetParam().out_of_order_rate); scoped_refptr<protocol::TransportContext> transport_context( new protocol::TransportContext( - host_signaling_.get(), port_allocator_factory.Pass(), + host_signaling_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::SERVER)); std::vector<protocol::AuthenticationMethod> auth_methods; @@ -319,12 +318,11 @@ class ProtocolPerfTest std::string(), // client_pairing_secret std::string(), // authentication_tag base::Bind(&ProtocolPerfTest::FetchPin, base::Unretained(this)), - nullptr, - auth_methods)); + nullptr, auth_methods)); client_.reset( new ChromotingClient(client_context_.get(), this, this, nullptr)); client_->set_protocol_config(protocol_config_->Clone()); - client_->Start(client_signaling_.get(), client_authenticator.Pass(), + client_->Start(client_signaling_.get(), std::move(client_authenticator), transport_context, kHostJid, std::string()); } @@ -448,7 +446,7 @@ class IntermittentChangeFrameGenerator result->mutable_updated_region()->AddRect( webrtc::DesktopRect::MakeXYWH(0, 0, kWidth, kHeight)); } - return result.Pass(); + return result; } private: diff --git a/remoting/test/test_chromoting_client.cc b/remoting/test/test_chromoting_client.cc index 2e678e4..37d6264 100644 --- a/remoting/test/test_chromoting_client.cc +++ b/remoting/test/test_chromoting_client.cc @@ -5,6 +5,7 @@ #include "remoting/test/test_chromoting_client.h" #include <string> +#include <utility> #include <vector> #include "base/logging.h" @@ -72,7 +73,7 @@ TestChromotingClient::TestChromotingClient( scoped_ptr<VideoRenderer> video_renderer) : connection_to_host_state_(protocol::ConnectionToHost::INITIALIZING), connection_error_code_(protocol::OK), - video_renderer_(video_renderer.Pass()) {} + video_renderer_(std::move(video_renderer)) {} TestChromotingClient::~TestChromotingClient() { // Ensure any connections are closed and the members are destroyed in the @@ -104,7 +105,7 @@ void TestChromotingClient::StartConnection( if (test_connection_to_host_) { chromoting_client_->SetConnectionToHostForTests( - test_connection_to_host_.Pass()); + std::move(test_connection_to_host_)); } if (!signal_strategy_) { @@ -129,7 +130,7 @@ void TestChromotingClient::StartConnection( scoped_refptr<protocol::TransportContext> transport_context( new protocol::TransportContext( - signal_strategy_.get(), port_allocator_factory.Pass(), + signal_strategy_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::CLIENT)); scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> @@ -146,15 +147,12 @@ void TestChromotingClient::StartConnection( scoped_ptr<protocol::Authenticator> authenticator( new protocol::NegotiatingClientAuthenticator( - connection_setup_info.pairing_id, - connection_setup_info.shared_secret, - connection_setup_info.host_id, - fetch_secret_callback, - token_fetcher.Pass(), - connection_setup_info.auth_methods)); + connection_setup_info.pairing_id, connection_setup_info.shared_secret, + connection_setup_info.host_id, fetch_secret_callback, + std::move(token_fetcher), connection_setup_info.auth_methods)); chromoting_client_->Start( - signal_strategy_.get(), authenticator.Pass(), transport_context, + signal_strategy_.get(), std::move(authenticator), transport_context, connection_setup_info.host_jid, connection_setup_info.capabilities); } @@ -191,12 +189,12 @@ void TestChromotingClient::RemoveRemoteConnectionObserver( void TestChromotingClient::SetSignalStrategyForTests( scoped_ptr<SignalStrategy> signal_strategy) { - signal_strategy_ = signal_strategy.Pass(); + signal_strategy_ = std::move(signal_strategy); } void TestChromotingClient::SetConnectionToHostForTests( scoped_ptr<protocol::ConnectionToHost> connection_to_host) { - test_connection_to_host_ = connection_to_host.Pass(); + test_connection_to_host_ = std::move(connection_to_host); } void TestChromotingClient::OnConnectionState( diff --git a/remoting/test/test_video_renderer_unittest.cc b/remoting/test/test_video_renderer_unittest.cc index bf55954..9922089 100644 --- a/remoting/test/test_video_renderer_unittest.cc +++ b/remoting/test/test_video_renderer_unittest.cc @@ -7,6 +7,7 @@ #include <stdint.h> #include <cmath> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_vector.h" @@ -150,7 +151,7 @@ void TestVideoRendererTest::TestVideoPacketProcessing(int screen_width, run_loop_->QuitClosure()); // Wait for the video packet to be processed and rendered to buffer. - test_video_renderer_->ProcessVideoPacket(packet.Pass(), + test_video_renderer_->ProcessVideoPacket(std::move(packet), run_loop_->QuitClosure()); run_loop_->Run(); @@ -190,7 +191,7 @@ bool TestVideoRendererTest::SendPacketAndWaitForMatch( scoped_ptr<VideoPacket> packet_copy(new VideoPacket(*packet.get())); // Post first test packet: |packet|. - test_video_renderer_->ProcessVideoPacket(packet.Pass(), + test_video_renderer_->ProcessVideoPacket(std::move(packet), base::Bind(&base::DoNothing)); // Second packet: |packet_copy| is posted, and |second_packet_done_callback| @@ -201,7 +202,7 @@ bool TestVideoRendererTest::SendPacketAndWaitForMatch( base::Bind(&ProcessPacketDoneHandler, run_loop_->QuitClosure(), &second_packet_done_is_called); - test_video_renderer_->ProcessVideoPacket(packet_copy.Pass(), + test_video_renderer_->ProcessVideoPacket(std::move(packet_copy), second_packet_done_callback); run_loop_->Run(); @@ -232,7 +233,7 @@ void TestVideoRendererTest::TestImagePatternMatch( scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame.get()); if (expect_to_match) { - EXPECT_TRUE(SendPacketAndWaitForMatch(packet.Pass(), expected_rect, + EXPECT_TRUE(SendPacketAndWaitForMatch(std::move(packet), expected_rect, expected_average_color)); } else { // Shift each channel by 128. @@ -246,7 +247,7 @@ void TestVideoRendererTest::TestImagePatternMatch( RGBValue expected_average_color_shift = RGBValue(red_shift, green_shift, blue_shift); - EXPECT_FALSE(SendPacketAndWaitForMatch(packet.Pass(), expected_rect, + EXPECT_FALSE(SendPacketAndWaitForMatch(std::move(packet), expected_rect, expected_average_color_shift)); } } @@ -340,7 +341,7 @@ scoped_ptr<webrtc::DesktopFrame> frame->mutable_updated_region()->SetRect( webrtc::DesktopRect::MakeSize(screen_size)); FillFrameWithGradient(frame.get()); - return frame.Pass(); + return frame; } void TestVideoRendererTest::FillFrameWithGradient( @@ -450,8 +451,7 @@ TEST_F(TestVideoRendererTest, VerifySetExpectedImagePattern) { kDefaultExpectedRect, black_color, base::Bind(&base::DoNothing)); // Post test video packet. - scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame.get()); - test_video_renderer_->ProcessVideoPacket(packet.Pass(), + test_video_renderer_->ProcessVideoPacket(encoder_->Encode(*frame.get()), base::Bind(&base::DoNothing)); } |