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

Unified Diff: net/socket/socket_test_util.cc

Issue 3039028: Make HttpAuthController not reference counted. (Closed)
Patch Set: Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/ssl_client_socket_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/ssl_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698