| Index: chrome/browser/sync/tools/chrome_async_socket_unittest.cc
|
| diff --git a/chrome/browser/sync/tools/chrome_async_socket_unittest.cc b/chrome/browser/sync/tools/chrome_async_socket_unittest.cc
|
| index 225a215af52b02cda10e5ad600e8534ed02f0cf6..bf33ea5092c931a068857ef5d7161af22ade98aa 100644
|
| --- a/chrome/browser/sync/tools/chrome_async_socket_unittest.cc
|
| +++ b/chrome/browser/sync/tools/chrome_async_socket_unittest.cc
|
| @@ -97,7 +97,6 @@ class ChromeAsyncSocketTest
|
| : public testing::Test,
|
| public sigslot::has_slots<> {
|
| protected:
|
| - // TODO(akalin): test SSL states other than connection success.
|
| ChromeAsyncSocketTest()
|
| : ssl_socket_data_provider_(true, net::OK),
|
| capturing_net_log_(net::CapturingNetLog::kUnbounded),
|
| @@ -529,6 +528,12 @@ TEST_F(ChromeAsyncSocketTest, EmptyRead) {
|
|
|
| TEST_F(ChromeAsyncSocketTest, WrongRead) {
|
| EXPECT_DEBUG_DEATH({
|
| + async_socket_data_provider_.set_connect_data(
|
| + net::MockConnect(true, net::OK));
|
| + EXPECT_TRUE(chrome_async_socket_.Connect(addr_));
|
| + ExpectNonErrorState(ChromeAsyncSocket::STATE_CONNECTING);
|
| + ExpectNoSignal();
|
| +
|
| char buf[4096];
|
| size_t len_read;
|
| EXPECT_FALSE(chrome_async_socket_.Read(buf, sizeof(buf), &len_read));
|
| @@ -538,6 +543,15 @@ TEST_F(ChromeAsyncSocketTest, WrongRead) {
|
| }, "non-open");
|
| }
|
|
|
| +TEST_F(ChromeAsyncSocketTest, WrongReadClosed) {
|
| + char buf[4096];
|
| + size_t len_read;
|
| + EXPECT_FALSE(chrome_async_socket_.Read(buf, sizeof(buf), &len_read));
|
| + ExpectErrorState(ChromeAsyncSocket::STATE_CLOSED,
|
| + ChromeAsyncSocket::ERROR_WRONGSTATE);
|
| + EXPECT_TRUE(chrome_async_socket_.Close());
|
| +}
|
| +
|
| const char kReadData[] = "mydatatoread";
|
|
|
| TEST_F(ChromeAsyncSocketTest, Read) {
|
| @@ -823,6 +837,26 @@ TEST_F(ChromeAsyncSocketTest, DoubleSSLConnect) {
|
| }, "wrong state");
|
| }
|
|
|
| +TEST_F(ChromeAsyncSocketTest, FailedSSLConnect) {
|
| + ssl_socket_data_provider_.connect =
|
| + net::MockConnect(true, net::ERR_CERT_COMMON_NAME_INVALID),
|
| +
|
| + async_socket_data_provider_.AddRead(net::MockRead(kReadData));
|
| + DoOpenClosed();
|
| + ExpectReadSignal();
|
| +
|
| + EXPECT_TRUE(chrome_async_socket_.StartTls("fakedomain.com"));
|
| + message_loop_.RunAllPending();
|
| + ExpectSignalSocketState(
|
| + SignalSocketState(
|
| + SIGNAL_CLOSE, ChromeAsyncSocket::STATE_CLOSED,
|
| + ChromeAsyncSocket::ERROR_WINSOCK,
|
| + net::ERR_CERT_COMMON_NAME_INVALID));
|
| +
|
| + EXPECT_TRUE(chrome_async_socket_.Close());
|
| + ExpectClosed();
|
| +}
|
| +
|
| TEST_F(ChromeAsyncSocketTest, ReadDuringSSLConnecting) {
|
| async_socket_data_provider_.AddRead(net::MockRead(kReadData));
|
| DoOpenClosed();
|
|
|