Index: net/socket/socket_test_util.cc |
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc |
index 0d755160991ca3b19ac96d735a72aec103822a59..0a4055fbf1bead2600d3bbed74047467d362f729 100644 |
--- a/net/socket/socket_test_util.cc |
+++ b/net/socket/socket_test_util.cc |
@@ -11,6 +11,7 @@ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/message_loop.h" |
+#include "base/string_util.h" |
#include "base/time.h" |
#include "net/base/address_family.h" |
#include "net/base/auth.h" |
@@ -891,7 +892,8 @@ MockHttpAuthController::MockHttpAuthController() |
scoped_refptr<HttpNetworkSession>(NULL)), |
data_(NULL), |
data_index_(0), |
- data_count_(0) { |
+ data_count_(0), |
+ next_index_(0) { |
} |
void MockHttpAuthController::SetMockAuthControllerData( |
@@ -920,9 +922,16 @@ int MockHttpAuthController::HandleAuthChallenge( |
return OK; |
} |
-void MockHttpAuthController::ResetAuth(const std::wstring& username, |
- const std::wstring& password) { |
- data_index_++; |
+void MockHttpAuthController::SetCredentials(const std::wstring& username, |
+ const std::wstring& password) { |
+ EXPECT_EQ(ASCIIToWide(CurrentData().username), username); |
+ EXPECT_EQ(ASCIIToWide(CurrentData().password), password); |
+ next_index_ = data_index_ + 1; |
+ data_index_ = data_count_; |
+} |
+ |
+void MockHttpAuthController::PrepareForAuthRestart() { |
+ data_index_ = next_index_; |
} |
bool MockHttpAuthController::HaveAuth() const { |
@@ -933,6 +942,16 @@ bool MockHttpAuthController::HaveAuthHandler() const { |
return HaveAuth(); |
} |
+HttpAuth::Identity MockHttpAuthController::AuthIdentity() { |
+ HttpAuth::Identity identity; |
+ identity.source = HttpAuth::IDENT_SRC_EXTERNAL; |
+ identity.invalid = false; |
+ identity.username = ASCIIToWide(CurrentData().username); |
+ identity.password = ASCIIToWide(CurrentData().password); |
+ data_index_++; |
+ return identity; |
+} |
+ |
const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
const int kSOCKS5GreetRequestLength = arraysize(kSOCKS5GreetRequest); |