Skip to content

Commit

Permalink
Backport some tests in /jingle to SingleThreadTaskEnvironment
Browse files Browse the repository at this point in the history
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
/jingle.

This CL is a no-op if it passes CQ.

This CL was uploaded by git cl split.

R=sergeyu@chromium.org

Bug: 891670
Change-Id: I66d5be191e3c335b0f584b011c78956a234fc08b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1786950
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693519}
  • Loading branch information
Gabriel Charette authored and Commit Bot committed Sep 5, 2019
1 parent 6bd9391 commit 3e47fc8
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion jingle/glue/fake_ssl_client_socket_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class FakeSSLClientSocketTest : public testing::Test {
}

// MockTCPClientSocket needs a message loop.
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;

net::MockClientSocketFactory mock_client_socket_factory_;
std::unique_ptr<net::StaticSocketDataProvider> static_socket_data_provider_;
Expand Down
2 changes: 1 addition & 1 deletion jingle/glue/network_service_async_socket_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ class NetworkServiceAsyncSocketTest : public testing::Test,
}

// Need a message loop for both the socket and Mojo.
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;

AsyncSocketDataProvider async_socket_data_provider_;
net::SSLSocketDataProvider ssl_socket_data_provider_;
Expand Down
2 changes: 1 addition & 1 deletion jingle/glue/task_pump_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using ::testing::Return;

class TaskPumpTest : public testing::Test {
private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
};

TEST_F(TaskPumpTest, Basic) {
Expand Down
2 changes: 1 addition & 1 deletion jingle/glue/thread_wrapper_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ThreadWrapperTest : public testing::Test {
}

// ThreadWrapper destroyes itself when |message_loop_| is destroyed.
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
rtc::Thread* thread_;
MockMessageHandler handler1_;
MockMessageHandler handler2_;
Expand Down
2 changes: 1 addition & 1 deletion jingle/notifier/base/weak_xmpp_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class WeakXmppClientTest : public testing::Test {
}

// Needed by TaskPump.
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;

std::unique_ptr<jingle_glue::TaskPump> task_pump_;
MockXmppDelegate mock_xmpp_delegate_;
Expand Down
2 changes: 1 addition & 1 deletion jingle/notifier/base/xmpp_connection_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class XmppConnectionTest : public testing::Test {
}

// Needed by XmppConnection.
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
MockXmppConnectionDelegate mock_xmpp_connection_delegate_;
std::unique_ptr<MockPreXmppAuth> mock_pre_xmpp_auth_;
jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SingleLoginAttemptTest : public ::testing::Test {
}

private:
base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
const LoginSettings login_settings_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class NonBlockingPushClientTest : public testing::Test {
return std::unique_ptr<PushClient>(fake_push_client_);
}

base::test::TaskEnvironment task_environment_;
base::test::SingleThreadTaskEnvironment task_environment_;
FakePushClientObserver fake_observer_;
std::unique_ptr<NonBlockingPushClient> push_client_;
// Owned by |push_client_|.
Expand Down
4 changes: 2 additions & 2 deletions jingle/notifier/listener/push_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class PushClientTest : public testing::Test {
~PushClientTest() override {}

// The sockets created by the XMPP code expect an IO loop.
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
NotifierOptions notifier_options_;
};
Expand Down
4 changes: 2 additions & 2 deletions jingle/notifier/listener/xmpp_push_client_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class XmppPushClientTest : public testing::Test {
}

// The sockets created by the XMPP code expect an IO loop.
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::MainThreadType::IO};
base::test::SingleThreadTaskEnvironment task_environment_{
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};

jingle_glue::NetworkServiceConfigTestUtil net_config_helper_;
NotifierOptions notifier_options_;
Expand Down

0 comments on commit 3e47fc8

Please sign in to comment.