Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: net/socket/socket_test_util.cc

Issue 11428150: LoadTiming implementation in net, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix a header or two Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/socket/socket_test_util.h" 5 #include "net/socket/socket_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "net/base/address_family.h" 16 #include "net/base/address_family.h"
17 #include "net/base/address_list.h" 17 #include "net/base/address_list.h"
18 #include "net/base/auth.h" 18 #include "net/base/auth.h"
19 #include "net/base/load_timing_info.h"
19 #include "net/base/ssl_cert_request_info.h" 20 #include "net/base/ssl_cert_request_info.h"
20 #include "net/base/ssl_info.h" 21 #include "net/base/ssl_info.h"
21 #include "net/http/http_network_session.h" 22 #include "net/http/http_network_session.h"
22 #include "net/http/http_request_headers.h" 23 #include "net/http/http_request_headers.h"
23 #include "net/http/http_response_headers.h" 24 #include "net/http/http_response_headers.h"
24 #include "net/socket/client_socket_pool_histograms.h" 25 #include "net/socket/client_socket_pool_histograms.h"
25 #include "net/socket/socket.h" 26 #include "net/socket/socket.h"
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
27 28
28 // Socket events are easier to debug if you log individual reads and writes. 29 // Socket events are easier to debug if you log individual reads and writes.
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 handle_ = NULL; 1531 handle_ = NULL;
1531 user_callback_.Reset(); 1532 user_callback_.Reset();
1532 return true; 1533 return true;
1533 } 1534 }
1534 1535
1535 void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) { 1536 void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) {
1536 if (!socket_.get()) 1537 if (!socket_.get())
1537 return; 1538 return;
1538 if (rv == OK) { 1539 if (rv == OK) {
1539 handle_->set_socket(socket_.release()); 1540 handle_->set_socket(socket_.release());
1541
1542 // Needed for socket pool tests that layer other sockets on top of mock
1543 // sockets.
1544 LoadTimingInfo::ConnectTiming connect_timing;
1545 base::TimeTicks now = base::TimeTicks::Now();
1546 connect_timing.dns_start = now;
1547 connect_timing.dns_end = now;
1548 connect_timing.connect_start = now;
1549 connect_timing.connect_end = now;
1550 handle_->set_connect_timing(connect_timing);
1540 } else { 1551 } else {
1541 socket_.reset(); 1552 socket_.reset();
1542 } 1553 }
1543 1554
1544 handle_ = NULL; 1555 handle_ = NULL;
1545 1556
1546 if (!user_callback_.is_null()) { 1557 if (!user_callback_.is_null()) {
1547 CompletionCallback callback = user_callback_; 1558 CompletionCallback callback = user_callback_;
1548 user_callback_.Reset(); 1559 user_callback_.Reset();
1549 callback.Run(rv); 1560 callback.Run(rv);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 1706
1696 const char kSOCKS5OkRequest[] = 1707 const char kSOCKS5OkRequest[] =
1697 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1708 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1698 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1709 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1699 1710
1700 const char kSOCKS5OkResponse[] = 1711 const char kSOCKS5OkResponse[] =
1701 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1712 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1702 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1713 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1703 1714
1704 } // namespace net 1715 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | net/socket/socks_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698