summaryrefslogtreecommitdiffstats
path: root/net/socket/socket_test_util.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename GetNextProtocol -> GetNextProtoagl@chromium.org2009-12-111-1/+1
| | | | | | | | Following up on wtc's comments. http://codereview.chromium.org/484005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34370 0039d316-1c4b-4281-b951-d872f2087c98
* Add GetNextProtocol method to SSLClientSocket.agl@chromium.org2009-12-101-0/+1
| | | | | | http://codereview.chromium.org/484005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34288 0039d316-1c4b-4281-b951-d872f2087c98
* Fix bug where FLIP sessions can crash if the connect fails.mbelshe@google.com2009-12-041-0/+1
| | | | | | | | | | | | | | Update the mocksocket so that we can test connection statuses. Verified that the test case crashes without the flip_session.cc fix. BUG=none TEST=FlipNetworkTransaction.ConnectFailure Review URL: http://codereview.chromium.org/462023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33792 0039d316-1c4b-4281-b951-d872f2087c98
* Update network priorities to support better granularitymbelshe@google.com2009-12-021-1/+1
| | | | | | | | | | | | | | of resource loading from WebKit into the network stack. In order to fully make these work, webkit changes are needed as well. BUG=none TEST=none Review URL: http://codereview.chromium.org/452033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33546 0039d316-1c4b-4281-b951-d872f2087c98
* Remove extraneous semicolons.wtc@chromium.org2009-12-011-3/+3
| | | | | | | | | R=mbelshe BUG=none TEST=no compilation errors Review URL: http://codereview.chromium.org/450026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33407 0039d316-1c4b-4281-b951-d872f2087c98
* Define the GetPeerName method of the ClientSocket interface for allwtc@chromium.org2009-11-301-7/+4
| | | | | | | | | | | | | | | platforms, in preparation for using SSLClientSocketNSS on Windows. nss_memio.c does not need to include <unistd.h> Fix style nits. R=eroman BUG=28744 TEST=none Review URL: http://codereview.chromium.org/440031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33319 0039d316-1c4b-4281-b951-d872f2087c98
* Add a default constructor to the MockRead struct sombelshe@google.com2009-11-241-0/+3
| | | | | | | | | | | | that we can do things like dynamically create an array of them. BUG=none TEST=none Review URL: http://codereview.chromium.org/434039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32951 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 32807, which was incorrectly reverted.mbelshe@google.com2009-11-231-0/+2
| | | | | | | | | | | | | | | | | | The async notification via OnReadComplete was still posting a callback through this message loop. This makes it difficult to write tests, as callbacks already scheduled will go in front of the OnReadComplete(). Treat the notifications through OnReadComplete as synchronous always. This doesn't effect existing tests, but makes my new tests possible. BUG=none TEST=this is the test! Review URL: http://codereview.chromium.org/436014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32886 0039d316-1c4b-4281-b951-d872f2087c98
* Believe this causes the valgrind linux test failures. Since it is a small ↵tim@chromium.org2009-11-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | change I decided to revert instead of disable the test. Revert 32807 - The async notification via OnReadComplete was still posting a callback through this message loop. This makes it difficult to write tests, as callbacks already scheduled will go in front of the OnReadComplete(). Treat the notifications through OnReadComplete as synchronous always. This doesn't effect existing tests, but makes my new tests possible. TBR=mbelshe BUG=none TEST=this is the test! Review URL: http://codereview.chromium.org/414073 TBR=mbelshe@google.com Review URL: http://codereview.chromium.org/431016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32838 0039d316-1c4b-4281-b951-d872f2087c98
* The async notification via OnReadComplete was still postingmbelshe@google.com2009-11-231-0/+2
| | | | | | | | | | | | | | | | | a callback through this message loop. This makes it difficult to write tests, as callbacks already scheduled will go in front of the OnReadComplete(). Treat the notifications through OnReadComplete as synchronous always. This doesn't effect existing tests, but makes my new tests possible. BUG=none TEST=this is the test! Review URL: http://codereview.chromium.org/414073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32807 0039d316-1c4b-4281-b951-d872f2087c98
* After draining the body of a 401/407 response, verify thatwtc@chromium.org2009-11-121-0/+18
| | | | | | | | | | | | | | | | | the keep-alive connection is still connected and idle before reusing it for authentication restart. An impatient server may have closed the connection while waiting for the user to enter the username and password. In socket_test_util.cc, return the mock ERR_UNEXPECTED error synchronously. R=eroman BUG=21675 TEST=new unit test Review URL: http://codereview.chromium.org/389007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31846 0039d316-1c4b-4281-b951-d872f2087c98
* Enable async IO completions on MockSockets through thembelshe@google.com2009-11-111-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | SocketDataProvider. This makes a few changes: - The SocketDataProvider::GetNextRead() is now allowed to return a result of ERR_IO_PENDING. Previously, this was just an error. Now, this informs the MockClientSocket using the SocketDataProvider that the Mock IO will be completely asynchronously. - MockClientSocket implements a new method called OnReadComplete(). This method is used to asynchronously complete a Read from the SocketDataProvider. The MockClientSocket, after receiving ERR_IO_PENDING from SocketDataProvider::GetNextRead will be blocked until this call is made. The rest of the patch is just refactoring the MockTCPClientSocket to implement a true async-io simulation. It needs to record the user buffer from the initial read, and then fill it when the data is provided. BUG=none TEST=<this is for better testing> Review URL: http://codereview.chromium.org/392003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31723 0039d316-1c4b-4281-b951-d872f2087c98
* There was confusion in the mock socket classes due tombelshe@google.com2009-11-111-44/+46
| | | | | | | | | | | | | | | | | | | overlapping names. The MockSocket is not actually a socket. It is an interface for fetching data for reads and writes on a socket. The MockClientSocket and MockTCPClientSocket are the actual sockets. Rename MockSocket to SocketDataProvider. Rename SSLMockSocket to SSLSocketDataProvider. Update all tests to reflect name change. BUG=none TEST=none Review URL: http://codereview.chromium.org/384024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31640 0039d316-1c4b-4281-b951-d872f2087c98
* Add a couple of methods to the StaticMockSocket for verifyingmbelshe@google.com2009-11-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | that all data has been consumed from the Mock socket. Tests can optionally use this by including a zero-length read at the end of their data and then verifying that it is at the end. Example: MockWrite writes[] = { MockWrite( ... <data> ...), MockWrite( ... <data> ...), MockWrite( ... <data> ...), MockWrite(true, 0, 0), // Marks EOF } <run tests> EXPECT_EQ(mock_socket.at_write_eof()); TEST=this is the test BUG=none Review URL: http://codereview.chromium.org/385011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31605 0039d316-1c4b-4281-b951-d872f2087c98
* Add LoadLog to ClientSocket::Connect().willchan@chromium.org2009-11-021-3/+5
| | | | | | | | TODO: Use LoadLog in FLIP code. Review URL: http://codereview.chromium.org/344026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30765 0039d316-1c4b-4281-b951-d872f2087c98
* Make our Mock Sockets capable of running full duplex.mbelshe@google.com2009-10-091-2/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/273013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28622 0039d316-1c4b-4281-b951-d872f2087c98
* Add methods for setting socket buffers to the Socket mbelshe@google.com2009-09-091-0/+2
| | | | | | | | | | | | class. Also add a few stats counters for TCP read/write stats. BUG=none TEST=none Review URL: http://codereview.chromium.org/199048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25803 0039d316-1c4b-4281-b951-d872f2087c98
* Don't trust server's PASV response that much in FtpNetworkTransaction.phajdan.jr@chromium.org2009-08-281-6/+14
| | | | | | | | | TEST=Covered by net_unittests. http://crbug.com/20334 Review URL: http://codereview.chromium.org/180011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24818 0039d316-1c4b-4281-b951-d872f2087c98
* Fix transaction hang when downloading certain FTP files.phajdan.jr@chromium.org2009-08-261-0/+11
| | | | | | | | | TEST=Covered by net_unittests. http://crbug.com/19855 Review URL: http://codereview.chromium.org/174428 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24492 0039d316-1c4b-4281-b951-d872f2087c98
* Make ClientSocketHandle::Init() typesafe.willchan@chromium.org2009-08-191-7/+4
| | | | | | | | | | | Introduce a REGISTER_SOCKET_PARAMS_FOR_POOL macro to register valid SocketParams for a ClientSocketPool subtype. Update HttpNetworkSession's ClientSocketPool to return the concrete TCPClientSocketPool instead of the parent interface. Renamed the member variable&accessor. Updated tests. BUG=http://crbug.com/13289 Review URL: http://codereview.chromium.org/173018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23743 0039d316-1c4b-4281-b951-d872f2087c98
* Change ClientSocketHandle to take the pool as a parameter to Init() rather ↵willchan@chromium.org2009-08-181-5/+15
| | | | | | | | | | than the constructor. The purpose of this change is to allow ClientSocketHandle to be able to accept ClientSocketPools of different types, since we will want to pass a TCPClientSocketPool or an SSLClientSocketPool or whatever to it. BUG=http://crbug.com/13289 Review URL: http://codereview.chromium.org/171003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23629 0039d316-1c4b-4281-b951-d872f2087c98
* Followup after socket tests refactoring http://codereview.chromium.org/155925phajdan.jr@chromium.org2009-07-291-2/+3
| | | | | | | | | | | | | - more complete checks for data validity - private data member with getter instead of public data member, eh - replace some magic numbers with more readable constants TEST=none http://crbug.com/17445 Review URL: http://codereview.chromium.org/159514 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21957 0039d316-1c4b-4281-b951-d872f2087c98
* Refactoring in socket pool unittests:phajdan.jr@chromium.org2009-07-231-0/+69
| | | | | | | | | | | | | - share more code - improve readability - help detect cases we don't test order of all requests made TEST=Covered by net_unittests. http://crbug.com/17445 Review URL: http://codereview.chromium.org/155925 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21456 0039d316-1c4b-4281-b951-d872f2087c98
* Correctly handle multiple control response lines in new FTP transactionphajdan.jr@chromium.org2009-07-081-2/+8
| | | | | | | | | | | After this change it should correctly handle all cases of multiple 230 welcome responses. It also fixes some other related bugs. TEST=Covered by net_unittests. BUG=none Review URL: http://codereview.chromium.org/149211 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20148 0039d316-1c4b-4281-b951-d872f2087c98
* Fix up some code not to set off coverity warnings.willchan@chromium.org2009-07-061-1/+0
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/149149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19962 0039d316-1c4b-4281-b951-d872f2087c98
* Tests for socks4/4a implementation.arindam@chromium.org2009-06-281-0/+85
| | | | | | | | | | | Refactoring of void BuildHandshakeWriteBuffer() to const std::string BuildHandshakeWriteBuffer() const,and removing private members handshake_buf_len_ and buffer_len_ (since buffer_ is now std::string, buffer_.size()) is more than sufficient for buffer size. TEST=unittests BUG=469 Review URL: http://codereview.chromium.org/139009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19474 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 19466.thakis@chromium.org2009-06-271-85/+0
| | | | | | Review URL: http://codereview.chromium.org/150003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19468 0039d316-1c4b-4281-b951-d872f2087c98
* Tests for socks4/4a implementation.arindam@chromium.org2009-06-271-0/+85
| | | | | | | | | | | | Refactoring of void BuildHandshakeWriteBuffer() to const std::string BuildHandshakeWriteBuffer() const, and removing private members handshake_buf_len_ and buffer_len_ (since buffer_ is now std::string, buffer_.size()) is more than sufficient. TEST=unittests BUG=469 Review URL: http://codereview.chromium.org/139009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19466 0039d316-1c4b-4281-b951-d872f2087c98
* reverting the change 19354, 19356arindam@chromium.org2009-06-261-85/+0
| | | | | | | | | | | TEST=none BUG=none TBR=eroman Review URL: http://codereview.chromium.org/149076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19357 0039d316-1c4b-4281-b951-d872f2087c98
* Tests for socks4/4a implementation.arindam@chromium.org2009-06-261-0/+85
| | | | | | | | | | | | Refactoring of void BuildHandshakeWriteBuffer() to const std::string BuildHandshakeWriteBuffer() const, and removing private members handshake_buf_len_ and buffer_len_ (since buffer_ is now std::string, buffer_.size()) is more than sufficient. TEST=unittests BUG=none Review URL: http://codereview.chromium.org/139009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19354 0039d316-1c4b-4281-b951-d872f2087c98
* Make more things possible with mock sockets:phajdan.jr@chromium.org2009-06-251-9/+10
| | | | | | | | | | | | - check connection state in mock read and write - make possible simulating short reads in DynamicMockSocket TEST=none http://crbug.com/15259 Review URL: http://codereview.chromium.org/147117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19222 0039d316-1c4b-4281-b951-d872f2087c98
* Move socket related files from net/base to net/socket.willchan@chromium.org2009-06-221-0/+204
Review URL: http://codereview.chromium.org/144009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18985 0039d316-1c4b-4281-b951-d872f2087c98