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

Side by Side Diff: net/http/http_auth_controller_unittest.cc

Issue 623213004: replace OVERRIDE and FINAL with override and final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo unwanted change in comment Created 6 years, 2 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
« no previous file with comments | « net/http/http_auth_cache_unittest.cc ('k') | net/http/http_auth_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/http/http_auth_controller.h" 5 #include "net/http/http_auth_controller.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/net_log.h" 9 #include "net/base/net_log.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) { 121 TEST(HttpAuthControllerTest, NoExplicitCredentialsAllowed) {
122 // Modified mock HttpAuthHandler for this test. 122 // Modified mock HttpAuthHandler for this test.
123 class MockHandler : public HttpAuthHandlerMock { 123 class MockHandler : public HttpAuthHandlerMock {
124 public: 124 public:
125 MockHandler(int expected_rv, HttpAuth::Scheme scheme) 125 MockHandler(int expected_rv, HttpAuth::Scheme scheme)
126 : expected_scheme_(scheme) { 126 : expected_scheme_(scheme) {
127 SetGenerateExpectation(false, expected_rv); 127 SetGenerateExpectation(false, expected_rv);
128 } 128 }
129 129
130 protected: 130 protected:
131 virtual bool Init(HttpAuthChallengeTokenizer* challenge) OVERRIDE { 131 virtual bool Init(HttpAuthChallengeTokenizer* challenge) override {
132 HttpAuthHandlerMock::Init(challenge); 132 HttpAuthHandlerMock::Init(challenge);
133 set_allows_default_credentials(true); 133 set_allows_default_credentials(true);
134 set_allows_explicit_credentials(false); 134 set_allows_explicit_credentials(false);
135 set_connection_based(true); 135 set_connection_based(true);
136 // Pretend to be SCHEME_BASIC so we can test failover logic. 136 // Pretend to be SCHEME_BASIC so we can test failover logic.
137 if (challenge->scheme() == "Basic") { 137 if (challenge->scheme() == "Basic") {
138 auth_scheme_ = HttpAuth::AUTH_SCHEME_BASIC; 138 auth_scheme_ = HttpAuth::AUTH_SCHEME_BASIC;
139 --score_; // Reduce score, so we rank below Mock. 139 --score_; // Reduce score, so we rank below Mock.
140 set_allows_explicit_credentials(true); 140 set_allows_explicit_credentials(true);
141 } 141 }
142 EXPECT_EQ(expected_scheme_, auth_scheme_); 142 EXPECT_EQ(expected_scheme_, auth_scheme_);
143 return true; 143 return true;
144 } 144 }
145 145
146 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials, 146 virtual int GenerateAuthTokenImpl(const AuthCredentials* credentials,
147 const HttpRequestInfo* request, 147 const HttpRequestInfo* request,
148 const CompletionCallback& callback, 148 const CompletionCallback& callback,
149 std::string* auth_token) OVERRIDE { 149 std::string* auth_token) override {
150 int result = 150 int result =
151 HttpAuthHandlerMock::GenerateAuthTokenImpl(credentials, 151 HttpAuthHandlerMock::GenerateAuthTokenImpl(credentials,
152 request, callback, 152 request, callback,
153 auth_token); 153 auth_token);
154 EXPECT_TRUE(result != OK || 154 EXPECT_TRUE(result != OK ||
155 !AllowsExplicitCredentials() || 155 !AllowsExplicitCredentials() ||
156 !credentials->Empty()); 156 !credentials->Empty());
157 return result; 157 return result;
158 } 158 }
159 159
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 EXPECT_TRUE(controller->HaveAuth()); 230 EXPECT_TRUE(controller->HaveAuth());
231 EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK)); 231 EXPECT_TRUE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_MOCK));
232 EXPECT_FALSE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_BASIC)); 232 EXPECT_FALSE(controller->IsAuthSchemeDisabled(HttpAuth::AUTH_SCHEME_BASIC));
233 233
234 // Should only succeed if we are using the AUTH_SCHEME_BASIC MockHandler. 234 // Should only succeed if we are using the AUTH_SCHEME_BASIC MockHandler.
235 EXPECT_EQ(OK, controller->MaybeGenerateAuthToken( 235 EXPECT_EQ(OK, controller->MaybeGenerateAuthToken(
236 &request, CompletionCallback(), dummy_log)); 236 &request, CompletionCallback(), dummy_log));
237 } 237 }
238 238
239 } // namespace net 239 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_cache_unittest.cc ('k') | net/http/http_auth_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698