summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authorckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-22 20:56:30 +0000
committerckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-22 20:56:30 +0000
commitf70eac0ea8b5f05302b70211c6d1e6afb92f552f (patch)
treee0c57ffdd0125e6aa4137a81a74cdcfe02c9563b /jingle
parent57e6eb80bebfd196e2efeb44f396aa3b12a177f5 (diff)
downloadchromium_src-f70eac0ea8b5f05302b70211c6d1e6afb92f552f.zip
chromium_src-f70eac0ea8b5f05302b70211c6d1e6afb92f552f.tar.gz
chromium_src-f70eac0ea8b5f05302b70211c6d1e6afb92f552f.tar.bz2
Revert of [Mac] Reland r276808 Use a native MessagePump instead of a MessagePumpDefault (https://coderevie… (https://codereview.chromium.org/331983002/)
Reason for revert: Breaks XmppConnectionTest.MultipleConnect on Mac: http://build.chromium.org/p/chromium.mac/builders/Mac%2010.6%20Tests%20%28dbg%29%281%29/builds/50525 Original issue's description: > Reland change to use a native MessagePump instead of a MessagePumpDefault. > Original CL: https://codereview.chromium.org/331513002/ > > The previous CL caused a bunch of LibJingle unit tests to fail because the tests > were using a gtest death test which runs in the context of a fork()ed but not > execu()ed process. > > A CF Message loop can't live in this environment. Explicitly construct a > MessagePumpDefault for these tests. > > BUG=356804,385604 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=279013 TBR=mark@chromium.org,ajwong@chromium.org,jeremy@chromium.org NOTREECHECKS=true NOTRY=true BUG=356804,385604 Review URL: https://codereview.chromium.org/332333004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/glue/chrome_async_socket_unittest.cc87
1 files changed, 39 insertions, 48 deletions
diff --git a/jingle/glue/chrome_async_socket_unittest.cc b/jingle/glue/chrome_async_socket_unittest.cc
index b3c81b1..db3d2b0 100644
--- a/jingle/glue/chrome_async_socket_unittest.cc
+++ b/jingle/glue/chrome_async_socket_unittest.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "base/message_loop/message_pump_default.h"
#include "jingle/glue/resolving_client_socket_factory.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
@@ -144,15 +143,7 @@ class ChromeAsyncSocketTest
protected:
ChromeAsyncSocketTest()
: ssl_socket_data_provider_(net::ASYNC, net::OK),
- addr_("localhost", 35) {
- // GTest death tests execute in a fork()ed but not exec()ed process.
- // On OS X a CoreFoundation-backed message loop will exit with a
- // __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__
- // when called.
- // Explicitly create a MessagePumpDefault which can run in this enivronment.
- scoped_ptr<base::MessagePump> pump(new base::MessagePumpDefault());
- message_loop_.reset(new base::MessageLoop(pump.Pass()));
- }
+ addr_("localhost", 35) {}
virtual ~ChromeAsyncSocketTest() {}
@@ -191,7 +182,7 @@ class ChromeAsyncSocketTest
virtual void TearDown() {
// Run any tasks that we forgot to pump.
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectClosed();
ExpectNoSignal();
chrome_async_socket_.reset();
@@ -351,7 +342,7 @@ class ChromeAsyncSocketTest
EXPECT_TRUE(chrome_async_socket_->Connect(addr_));
ExpectNonErrorState(ChromeAsyncSocket::STATE_CONNECTING);
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
// We may not necessarily be open; may have been other events
// queued up.
ExpectSignalSocketState(
@@ -381,7 +372,7 @@ class ChromeAsyncSocketTest
EXPECT_EQ(kDummyData, DrainRead(1));
EXPECT_TRUE(chrome_async_socket_->StartTls("fakedomain.com"));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSSLConnectSignal();
ExpectNoSignal();
ExpectNonErrorState(ChromeAsyncSocket::STATE_TLS_OPEN);
@@ -424,7 +415,7 @@ class ChromeAsyncSocketTest
}
// ChromeAsyncSocket expects a message loop.
- scoped_ptr<base::MessageLoop> message_loop_;
+ base::MessageLoop message_loop_;
AsyncSocketDataProvider async_socket_data_provider_;
net::SSLSocketDataProvider ssl_socket_data_provider_;
@@ -519,7 +510,7 @@ TEST_F(ChromeAsyncSocketTest, ImmediateConnectCloseBeforeRead) {
SignalSocketState::NoError(
SIGNAL_CLOSE, ChromeAsyncSocket::STATE_CLOSED));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
}
TEST_F(ChromeAsyncSocketTest, HangingConnect) {
@@ -541,14 +532,14 @@ TEST_F(ChromeAsyncSocketTest, PendingConnect) {
ExpectNonErrorState(ChromeAsyncSocket::STATE_CONNECTING);
ExpectNoSignal();
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectNonErrorState(ChromeAsyncSocket::STATE_OPEN);
ExpectSignalSocketState(
SignalSocketState::NoError(
SIGNAL_CONNECT, ChromeAsyncSocket::STATE_OPEN));
ExpectNoSignal();
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
DoCloseOpenedNoError();
}
@@ -561,14 +552,14 @@ TEST_F(ChromeAsyncSocketTest, PendingConnectCloseBeforeRead) {
net::MockConnect(net::ASYNC, net::OK));
EXPECT_TRUE(chrome_async_socket_->Connect(addr_));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSignalSocketState(
SignalSocketState::NoError(
SIGNAL_CONNECT, ChromeAsyncSocket::STATE_OPEN));
DoCloseOpenedNoError();
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
}
TEST_F(ChromeAsyncSocketTest, PendingConnectError) {
@@ -576,7 +567,7 @@ TEST_F(ChromeAsyncSocketTest, PendingConnectError) {
net::MockConnect(net::ASYNC, net::ERR_TIMED_OUT));
EXPECT_TRUE(chrome_async_socket_->Connect(addr_));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSignalSocketState(
SignalSocketState(
@@ -638,7 +629,7 @@ TEST_F(ChromeAsyncSocketTest, Read) {
EXPECT_EQ(kReadData, DrainRead(1));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
DoCloseOpenedNoError();
}
@@ -652,7 +643,7 @@ TEST_F(ChromeAsyncSocketTest, ReadTwice) {
EXPECT_EQ(kReadData, DrainRead(1));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
const char kReadData2[] = "mydatatoread2";
async_socket_data_provider_.AddRead(net::MockRead(kReadData2));
@@ -674,7 +665,7 @@ TEST_F(ChromeAsyncSocketTest, ReadError) {
EXPECT_EQ(kReadData, DrainRead(1));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
async_socket_data_provider_.AddRead(
net::MockRead(net::SYNCHRONOUS, net::ERR_TIMED_OUT));
@@ -708,7 +699,7 @@ TEST_F(ChromeAsyncSocketTest, PendingRead) {
EXPECT_EQ(kReadData, DrainRead(1));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
DoCloseOpenedNoError();
}
@@ -764,12 +755,12 @@ TEST_F(ChromeAsyncSocketTest, SyncWrite) {
DoOpenClosed();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData, 3));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 3, 5));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 8,
arraysize(kWriteData) - 8));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectNoSignal();
@@ -787,12 +778,12 @@ TEST_F(ChromeAsyncSocketTest, AsyncWrite) {
net::MockWrite(net::ASYNC, kWriteData + 8, arraysize(kWriteData) - 8));
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData, 3));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 3, 5));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 8,
arraysize(kWriteData) - 8));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectNoSignal();
@@ -810,12 +801,12 @@ TEST_F(ChromeAsyncSocketTest, AsyncWriteError) {
net::MockWrite(net::ASYNC, net::ERR_TIMED_OUT));
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData, 3));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 3, 5));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 8,
arraysize(kWriteData) - 8));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSignalSocketState(
SignalSocketState(
@@ -883,7 +874,7 @@ TEST_F(ChromeAsyncSocketTest, ImmediateSSLConnect) {
ExpectReadSignal();
EXPECT_TRUE(chrome_async_socket_->StartTls("fakedomain.com"));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSSLConnectSignal();
ExpectNoSignal();
ExpectNonErrorState(ChromeAsyncSocket::STATE_TLS_OPEN);
@@ -898,7 +889,7 @@ TEST_F(ChromeAsyncSocketTest, DoubleSSLConnect) {
ExpectReadSignal();
EXPECT_TRUE(chrome_async_socket_->StartTls("fakedomain.com"));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSSLConnectSignal();
ExpectNoSignal();
ExpectNonErrorState(ChromeAsyncSocket::STATE_TLS_OPEN);
@@ -922,7 +913,7 @@ TEST_F(ChromeAsyncSocketTest, FailedSSLConnect) {
ExpectReadSignal();
EXPECT_TRUE(chrome_async_socket_->StartTls("fakedomain.com"));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSignalSocketState(
SignalSocketState(
SIGNAL_CLOSE, ChromeAsyncSocket::STATE_CLOSED,
@@ -950,7 +941,7 @@ TEST_F(ChromeAsyncSocketTest, ReadDuringSSLConnecting) {
EXPECT_TRUE(chrome_async_socket_->Read(buf, sizeof(buf), &len_read));
EXPECT_EQ(0U, len_read);
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSSLConnectSignal();
ExpectSSLReadSignal();
ExpectNoSignal();
@@ -981,11 +972,11 @@ TEST_F(ChromeAsyncSocketTest, WriteDuringSSLConnecting) {
// TODO(akalin): Figure out how to test that the write happens
// *after* the SSL connect.
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSSLConnectSignal();
ExpectNoSignal();
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
DoSSLCloseOpenedNoError();
}
@@ -1014,7 +1005,7 @@ TEST_F(ChromeAsyncSocketTest, SSLConnectDuringPostedWrite) {
EXPECT_FALSE(chrome_async_socket_->StartTls("fakedomain.com"));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
DoCloseOpened(
SignalSocketState(SIGNAL_CLOSE,
@@ -1029,14 +1020,14 @@ TEST_F(ChromeAsyncSocketTest, SSLConnectDuringPostedWrite) {
TEST_F(ChromeAsyncSocketTest, SSLRead) {
DoSSLOpenClosed();
async_socket_data_provider_.AddRead(net::MockRead(kReadData));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectSSLReadSignal();
ExpectNoSignal();
EXPECT_EQ(kReadData, DrainRead(1));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
DoSSLCloseOpenedNoError();
}
@@ -1052,12 +1043,12 @@ TEST_F(ChromeAsyncSocketTest, SSLSyncWrite) {
DoSSLOpenClosed();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData, 3));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 3, 5));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 8,
arraysize(kWriteData) - 8));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectNoSignal();
@@ -1075,12 +1066,12 @@ TEST_F(ChromeAsyncSocketTest, SSLAsyncWrite) {
net::MockWrite(net::ASYNC, kWriteData + 8, arraysize(kWriteData) - 8));
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData, 3));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 3, 5));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
EXPECT_TRUE(chrome_async_socket_->Write(kWriteData + 8,
arraysize(kWriteData) - 8));
- message_loop_->RunUntilIdle();
+ message_loop_.RunUntilIdle();
ExpectNoSignal();