Skip to content

Commit

Permalink
Revert "Backport some tests in /remoting to SingleThreadTaskEnvironment"
Browse files Browse the repository at this point in the history
This reverts commit afa2cbc.

Reason for revert: non_viz_browser_tests failed because of:
OAuth2Test.SetInvalidTokenStatus

https://ci.chromium.org/p/chrome/builders/ci/linux-chromeos-google-rel/6325

Original change's description:
> Backport some tests in /remoting to SingleThreadTaskEnvironment
> 
> These tests were previously migrated from single-threaded MessageLoop to
> a multi-threaded TaskEnvironment (then named ScopedTaskEnvironment) as
> part of crbug.com/891670.
> 
> //base OWNERS decided in retrospect that it was better to keep a
> single-threaded option for TaskEnvironment and introduced
> SingleThreadTaskEnvironment. This CL retrofits that decision for
> /remoting.
> 
> This CL is a no-op if it passes CQ.
> 
> This CL was uploaded by git cl split.
> 
> R=​jamiewalch@chromium.org
> 
> Bug: 891670
> Change-Id: Id50cc3412d6fbec3e5c71672bf74f6abf0f7332d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786679
> Auto-Submit: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Lambros Lambrou <lambroslambrou@chromium.org>
> Commit-Queue: Lambros Lambrou <lambroslambrou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#693548}

TBR=jamiewalch@chromium.org,lambroslambrou@chromium.org,gab@chromium.org

Change-Id: Ibe96ffa6ddf39371dc64c6ad7236ec366f9331c4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 891670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787279
Reviewed-by: Olga Sharonova <olka@chromium.org>
Commit-Queue: Olga Sharonova <olka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693613}
  • Loading branch information
Olga Sharonova authored and Commit Bot committed Sep 5, 2019
1 parent 895b067 commit 85d4a0f
Show file tree
Hide file tree
Showing 66 changed files with 96 additions and 99 deletions.
2 changes: 1 addition & 1 deletion remoting/base/auto_thread_task_runner_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace remoting {

TEST(AutoThreadTaskRunnerTest, StartAndStop) {
// Create a task runner.
base::test::SingleThreadTaskEnvironment task_environment;
base::test::TaskEnvironment task_environment;
base::RunLoop run_loop;
scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner(
task_environment.GetMainThreadTaskRunner(), run_loop.QuitClosure());
Expand Down
2 changes: 1 addition & 1 deletion remoting/base/auto_thread_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class AutoThreadTest : public testing::Test {
protected:
void QuitMainMessageLoop() { std::move(quit_closure_).Run(); }

base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
base::OnceClosure quit_closure_;
scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
};
Expand Down
2 changes: 1 addition & 1 deletion remoting/base/buffered_socket_writer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class BufferedSocketWriterTest : public testing::Test {
VerifyWrittenData();
}

base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
net::NetLog net_log_;
SocketDataProvider socket_data_provider_;
std::unique_ptr<net::StreamSocket> socket_;
Expand Down
2 changes: 1 addition & 1 deletion remoting/base/oauth_token_getter_proxy_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class OAuthTokenGetterProxyTest : public testing::Test {

std::unique_ptr<TokenCallbackResult> expected_callback_result_;

base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;

DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetterProxyTest);
};
Expand Down
2 changes: 1 addition & 1 deletion remoting/base/telemetry_log_writer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class TelemetryLogWriterTest : public testing::Test {

private:
int id_ = 0;
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
};

// Test workflow: add request -> log event -> respond request.
Expand Down
2 changes: 1 addition & 1 deletion remoting/client/display/gl_renderer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class GlRendererTest : public testing::Test {
return on_desktop_frame_processed_call_count_;
}

base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
std::unique_ptr<GlRenderer> renderer_;
FakeGlRendererDelegate delegate_;

Expand Down
2 changes: 1 addition & 1 deletion remoting/client/queued_task_poster_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class QueuedTaskPosterTest : public testing::Test {
void AssertSequenceNotStarted();

base::Thread target_thread_;
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
bool sequence_started_ = false;
};

Expand Down
2 changes: 1 addition & 1 deletion remoting/client/software_video_renderer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class SoftwareVideoRendererTest : public ::testing::Test {
}

protected:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
ClientContext context_;

TestFrameConsumer frame_consumer_;
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/chromeos/clipboard_aura_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class ClipboardAuraTest : public testing::Test {
protected:
void StopAndResetClipboard();

base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::UI};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::UI};
ClientClipboard* client_clipboard_;
std::unique_ptr<ClipboardAura> clipboard_;
};
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/chromoting_host_context_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace remoting {
// A simple test that starts and stop the context. This tests the context
// operates properly and all threads and message loops are valid.
TEST(ChromotingHostContextTest, StartAndStop) {
base::test::SingleThreadTaskEnvironment task_environment{
base::test::SingleThreadTaskEnvironment::MainThreadType::UI};
base::test::TaskEnvironment task_environment{
base::test::TaskEnvironment::MainThreadType::UI};
base::RunLoop run_loop;

std::unique_ptr<ChromotingHostContext> context =
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/client_session_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ClientSessionTest : public testing::Test {
int curr_display_;

// Message loop that will process all ClientSession tasks.
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;

// AutoThreadTaskRunner on which |client_session_| will be run.
scoped_refptr<AutoThreadTaskRunner> task_runner_;
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/config_file_watcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class ConfigFileWatcherTest : public testing::Test {
void StopWatcher();

protected:
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::UI};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::UI};
base::RunLoop run_loop_;

ConfigFileWatcherDelegate delegate_;
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/daemon_process_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class DaemonProcessTest : public testing::Test {
}

protected:
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};

std::unique_ptr<MockDaemonProcess> daemon_process_;
int terminal_id_;
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/desktop_process_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class DesktopProcessTest : public testing::Test {
MockDaemonListener daemon_listener_;

// Runs the daemon's end of the channel.
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::UI};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::UI};

scoped_refptr<AutoThreadTaskRunner> io_task_runner_;

Expand Down
2 changes: 1 addition & 1 deletion remoting/host/desktop_session_agent_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class DesktopSessionAgentTest : public ::testing::Test {
void Shutdown();

protected:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
base::RunLoop run_loop_;
scoped_refptr<AutoThreadTaskRunner> task_runner_;
scoped_refptr<DesktopSessionAgent> agent_;
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/gcd_rest_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GcdRestClientTest : public testing::Test {
GcdRestClient::Result last_result_ = GcdRestClient::OTHER_ERROR;

private:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
};

TEST_F(GcdRestClientTest, NetworkErrorGettingToken) {
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/host_power_save_blocker_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class HostPowerSaveBlockerTest : public testing::Test {

void SetUp() override;

base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::UI};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::UI};
base::Thread blocking_thread_;
scoped_refptr<HostStatusMonitor> monitor_;
std::unique_ptr<HostPowerSaveBlocker> blocker_;
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/host_status_logger_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class HostStatusLoggerTest : public testing::Test {
}

protected:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
MockSignalStrategy signal_strategy_;
std::unique_ptr<XmppLogToServer> log_to_server_;
std::unique_ptr<HostStatusLogger> host_status_logger_;
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/ipc_desktop_environment_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ class IpcDesktopEnvironmentTest : public testing::Test {

void RunMainLoopUntilDone();

base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::UI};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::UI};

// Runs until |desktop_session_proxy_| is connected to the desktop.
std::unique_ptr<base::RunLoop> setup_run_loop_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class It2MeConfirmationDialogProxyTest : public testing::Test {
}

private:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
base::RunLoop run_loop_;
base::Thread dialog_thread_;

Expand Down
2 changes: 1 addition & 1 deletion remoting/host/linux/audio_pipe_reader_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class AudioPipeReaderTest : public testing::Test,
}

protected:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
std::unique_ptr<base::Thread> audio_thread_;
base::ScopedTempDir test_dir_;
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/linux/certificate_watcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class CertificateWatcherTest : public testing::Test {
}
}

base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::ScopedTempDir temp_dir_;
std::unique_ptr<CertificateWatcher> watcher_;
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/linux/x11_character_injector_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class X11CharacterInjectorTest : public testing::Test {
std::unique_ptr<X11CharacterInjector> injector_;
FakeX11Keyboard* keyboard_; // Owned by |injector_|.

base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
};

void X11CharacterInjectorTest::SetUp() {
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/mouse_cursor_monitor_proxy_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class MouseCursorMonitorProxyTest
const webrtc::DesktopVector& position) override;

protected:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
base::RunLoop run_loop_;
base::Thread capture_thread_;
std::unique_ptr<MouseCursorMonitorProxy> proxy_;
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/mouse_shape_pump_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MouseShapePumpTest : public testing::Test {
void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape);

protected:
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
base::RunLoop run_loop_;
std::unique_ptr<MouseShapePump> pump_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class NativeMessagingReaderTest : public testing::Test {
private:
// MessageLoop declared here, since the NativeMessageReader ctor requires a
// MessageLoop to have been created.
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<base::RunLoop> run_loop_;
};

Expand Down
5 changes: 2 additions & 3 deletions remoting/host/policy_watcher_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class MockPolicyCallback {
class PolicyWatcherTest : public testing::Test {
public:
PolicyWatcherTest()
: task_environment_(
base::test::SingleThreadTaskEnvironment::MainThreadType::IO) {}
: task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}

void SetUp() override {
// We expect no callbacks unless explicitly specified by individual tests.
Expand Down Expand Up @@ -250,7 +249,7 @@ class PolicyWatcherTest : public testing::Test {
static const char* kHostDomain;
static const char* kClientDomain;
static const char* kPortRange;
base::test::SingleThreadTaskEnvironment task_environment_;
base::test::TaskEnvironment task_environment_;
MockPolicyCallback mock_policy_callback_;

// |policy_loader_| is owned by |policy_watcher_|. PolicyWatcherTest retains
Expand Down
4 changes: 2 additions & 2 deletions remoting/host/process_stats_sender_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class FakeProcessStatsAgent : public ProcessStatsAgent {
} // namespace

TEST(ProcessStatsSenderTest, ReportUsage) {
base::test::SingleThreadTaskEnvironment task_environment;
base::test::TaskEnvironment task_environment;
base::RunLoop run_loop;
FakeProcessStatsStub stub;
std::unique_ptr<ProcessStatsSender> stats;
Expand Down Expand Up @@ -134,7 +134,7 @@ TEST(ProcessStatsSenderTest, ReportUsage) {
}

TEST(ProcessStatsSenderTest, MergeUsage) {
base::test::SingleThreadTaskEnvironment task_environment;
base::test::TaskEnvironment task_environment;
base::RunLoop run_loop;
FakeProcessStatsStub stub;
std::unique_ptr<ProcessStatsSender> stats;
Expand Down
2 changes: 1 addition & 1 deletion remoting/host/resizing_host_observer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ TEST_F(ResizingHostObserverTest, RateLimited) {
resizing_host_observer_->SetNowFunctionForTesting(
base::Bind(&ResizingHostObserverTest::GetTime, base::Unretained(this)));

base::test::SingleThreadTaskEnvironment task_environment;
base::test::TaskEnvironment task_environment;
base::RunLoop run_loop;

EXPECT_EQ(MakeResolution(100, 100),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class SecurityKeyAuthHandlerPosixTest : public testing::Test {
}

protected:
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<base::RunLoop> run_loop_;

base::Thread file_thread_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class SecurityKeyAuthHandlerWinTest : public testing::Test {
mojo::NamedPlatformChannel::ServerName GetUniqueTestChannelHandle();

// IPC tests require a valid MessageLoop to run.
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};

// Used to allow |message_loop_| to run during tests. The instance is reset
// after each stage of the tests has been completed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ class SecurityKeyExtensionSessionTest : public testing::Test {
void CreateSecurityKeyConnection();

protected:
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};

// Object under test.
std::unique_ptr<SecurityKeyExtensionSession> security_key_extension_session_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class SecurityKeyIpcClientTest : public testing::Test {
mojo::NamedPlatformChannel::ServerName GenerateUniqueTestChannelName();

// IPC tests require a valid MessageLoop to run.
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};

// Used to allow |message_loop_| to run during tests. The instance is reset
// after each stage of the tests has been completed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class SecurityKeyIpcServerTest : public testing::Test,
uint32_t desktop_session_id() const override { return peer_session_id_; }

// IPC tests require a valid MessageLoop to run.
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};

// Used to allow |message_loop_| to run during tests. The instance is reset
// after each stage of the tests has been completed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class SecurityKeyMessageHandlerTest : public testing::Test {
std::unique_ptr<SecurityKeyMessageHandler> message_handler_;

private:
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<base::RunLoop> run_loop_;

DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageHandlerTest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class SecurityKeyMessageReaderImplTest : public testing::Test {
std::vector<std::unique_ptr<SecurityKeyMessage>> messages_received_;

private:
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
std::unique_ptr<base::RunLoop> run_loop_;

DISALLOW_COPY_AND_ASSIGN(SecurityKeyMessageReaderImplTest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ void SecurityKeyMessageWriterImplTest::WriteMessageToOutput(
reader_thread.StartWithOptions(options);

// Used to block until the read complete callback is triggered.
base::test::SingleThreadTaskEnvironment task_environment(
base::test::SingleThreadTaskEnvironment::MainThreadType::IO);
base::test::TaskEnvironment task_environment(
base::test::TaskEnvironment::MainThreadType::IO);
base::RunLoop run_loop;

ASSERT_TRUE(base::PostTaskAndReplyWithResult(
Expand Down
Loading

0 comments on commit 85d4a0f

Please sign in to comment.