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

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

Issue 3058013: Fix late binding induced mismatch of Socket and AuthController (Closed)
Patch Set: Address comments Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 10
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 return tcp_pool_->CancelRequest(group_name, handle); 879 return tcp_pool_->CancelRequest(group_name, handle);
880 } 880 }
881 881
882 void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, 882 void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name,
883 ClientSocket* socket, int id) { 883 ClientSocket* socket, int id) {
884 return tcp_pool_->ReleaseSocket(group_name, socket, id); 884 return tcp_pool_->ReleaseSocket(group_name, socket, id);
885 } 885 }
886 886
887 MockSOCKSClientSocketPool::~MockSOCKSClientSocketPool() {} 887 MockSOCKSClientSocketPool::~MockSOCKSClientSocketPool() {}
888 888
889 MockHttpAuthController::MockHttpAuthController()
890 : HttpAuthController(HttpAuth::AUTH_PROXY, GURL(),
891 scoped_refptr<HttpNetworkSession>(NULL)),
892 data_(NULL),
893 data_index_(0),
894 data_count_(0) {
895 }
896
897 void MockHttpAuthController::SetMockAuthControllerData(
898 struct MockHttpAuthControllerData* data, size_t count) {
899 data_ = data;
900 data_count_ = count;
901 }
902
903 int MockHttpAuthController::MaybeGenerateAuthToken(
904 const HttpRequestInfo* request,
905 CompletionCallback* callback,
906 const BoundNetLog& net_log) {
907 return OK;
908 }
909
910 void MockHttpAuthController::AddAuthorizationHeader(
911 HttpRequestHeaders* authorization_headers) {
912 authorization_headers->AddHeadersFromString(CurrentData().auth_header);
913 }
914
915 int MockHttpAuthController::HandleAuthChallenge(
916 scoped_refptr<HttpResponseHeaders> headers,
917 bool do_not_send_server_auth,
918 bool establishing_tunnel,
919 const BoundNetLog& net_log) {
920 return OK;
921 }
922
923 void MockHttpAuthController::ResetAuth(const string16& username,
924 const string16& password) {
925 data_index_++;
926 }
927
928 bool MockHttpAuthController::HaveAuth() const {
929 return CurrentData().auth_header.size() != 0;
930 }
931
932 bool MockHttpAuthController::HaveAuthHandler() const {
933 return HaveAuth();
934 }
935
936 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; 889 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 };
937 const int kSOCKS5GreetRequestLength = arraysize(kSOCKS5GreetRequest); 890 const int kSOCKS5GreetRequestLength = arraysize(kSOCKS5GreetRequest);
938 891
939 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; 892 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 };
940 const int kSOCKS5GreetResponseLength = arraysize(kSOCKS5GreetResponse); 893 const int kSOCKS5GreetResponseLength = arraysize(kSOCKS5GreetResponse);
941 894
942 const char kSOCKS5OkRequest[] = 895 const char kSOCKS5OkRequest[] =
943 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 896 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
944 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 897 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
945 898
946 const char kSOCKS5OkResponse[] = 899 const char kSOCKS5OkResponse[] =
947 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 900 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
948 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 901 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
949 902
950 } // namespace net 903 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698