| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/http/http_auth_cache.h" | 12 #include "net/http/http_auth_cache.h" |
| 13 #include "net/http/http_auth_handler.h" | 13 #include "net/http/http_auth_handler.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using base::ASCIIToUTF16; | 16 using base::ASCIIToUTF16; |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class MockAuthHandler : public HttpAuthHandler { | 22 class MockAuthHandler : public HttpAuthHandler { |
| 23 public: | 23 public: |
| 24 MockAuthHandler(HttpAuth::Scheme scheme, | 24 MockAuthHandler(const std::string& scheme, |
| 25 const std::string& realm, | 25 const std::string& realm, |
| 26 HttpAuth::Target target) { | 26 HttpAuth::Target target) { |
| 27 // Can't use initializer list since these are members of the base class. | 27 // Can't use initializer list since these are members of the base class. |
| 28 auth_scheme_ = scheme; | 28 auth_scheme_ = scheme; |
| 29 realm_ = realm; | 29 realm_ = realm; |
| 30 score_ = 1; | |
| 31 target_ = target; | 30 target_ = target; |
| 32 properties_ = 0; | |
| 33 } | 31 } |
| 34 | 32 |
| 35 HttpAuth::AuthorizationResult HandleAnotherChallenge( | 33 HttpAuth::AuthorizationResult HandleAnotherChallenge( |
| 36 HttpAuthChallengeTokenizer* challenge) override { | 34 HttpAuthChallengeTokenizer* challenge) override { |
| 37 return HttpAuth::AUTHORIZATION_RESULT_REJECT; | 35 return HttpAuth::AUTHORIZATION_RESULT_REJECT; |
| 38 } | 36 } |
| 39 | 37 |
| 40 protected: | 38 protected: |
| 41 bool Init(HttpAuthChallengeTokenizer* challenge) override { | 39 bool Init(HttpAuthChallengeTokenizer* challenge) override { |
| 42 return false; // Unused. | 40 return false; // Unused. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Test adding and looking-up cache entries (both by realm and by path). | 78 // Test adding and looking-up cache entries (both by realm and by path). |
| 81 TEST(HttpAuthCacheTest, Basic) { | 79 TEST(HttpAuthCacheTest, Basic) { |
| 82 GURL origin("http://www.google.com"); | 80 GURL origin("http://www.google.com"); |
| 83 HttpAuthCache cache; | 81 HttpAuthCache cache; |
| 84 HttpAuthCache::Entry* entry; | 82 HttpAuthCache::Entry* entry; |
| 85 | 83 |
| 86 // Add cache entries for 4 realms: "Realm1", "Realm2", "Realm3" and | 84 // Add cache entries for 4 realms: "Realm1", "Realm2", "Realm3" and |
| 87 // "Realm4" | 85 // "Realm4" |
| 88 | 86 |
| 89 scoped_ptr<HttpAuthHandler> realm1_handler( | 87 scoped_ptr<HttpAuthHandler> realm1_handler( |
| 90 new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC, | 88 new MockAuthHandler("basic", kRealm1, HttpAuth::AUTH_SERVER)); |
| 91 kRealm1, | |
| 92 HttpAuth::AUTH_SERVER)); | |
| 93 cache.Add(origin, realm1_handler->realm(), realm1_handler->auth_scheme(), | 89 cache.Add(origin, realm1_handler->realm(), realm1_handler->auth_scheme(), |
| 94 "Basic realm=Realm1", | 90 "Basic realm=Realm1", |
| 95 CreateASCIICredentials("realm1-user", "realm1-password"), | 91 CreateASCIICredentials("realm1-user", "realm1-password"), |
| 96 "/foo/bar/index.html"); | 92 "/foo/bar/index.html"); |
| 97 | 93 |
| 98 scoped_ptr<HttpAuthHandler> realm2_handler( | 94 scoped_ptr<HttpAuthHandler> realm2_handler( |
| 99 new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC, | 95 new MockAuthHandler("basic", kRealm2, HttpAuth::AUTH_SERVER)); |
| 100 kRealm2, | |
| 101 HttpAuth::AUTH_SERVER)); | |
| 102 cache.Add(origin, realm2_handler->realm(), realm2_handler->auth_scheme(), | 96 cache.Add(origin, realm2_handler->realm(), realm2_handler->auth_scheme(), |
| 103 "Basic realm=Realm2", | 97 "Basic realm=Realm2", |
| 104 CreateASCIICredentials("realm2-user", "realm2-password"), | 98 CreateASCIICredentials("realm2-user", "realm2-password"), |
| 105 "/foo2/index.html"); | 99 "/foo2/index.html"); |
| 106 | 100 |
| 107 scoped_ptr<HttpAuthHandler> realm3_basic_handler( | 101 scoped_ptr<HttpAuthHandler> realm3_basic_handler( |
| 108 new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC, | 102 new MockAuthHandler("basic", kRealm3, HttpAuth::AUTH_PROXY)); |
| 109 kRealm3, | |
| 110 HttpAuth::AUTH_PROXY)); | |
| 111 cache.Add( | 103 cache.Add( |
| 112 origin, | 104 origin, |
| 113 realm3_basic_handler->realm(), | 105 realm3_basic_handler->realm(), |
| 114 realm3_basic_handler->auth_scheme(), | 106 realm3_basic_handler->auth_scheme(), |
| 115 "Basic realm=Realm3", | 107 "Basic realm=Realm3", |
| 116 CreateASCIICredentials("realm3-basic-user", "realm3-basic-password"), | 108 CreateASCIICredentials("realm3-basic-user", "realm3-basic-password"), |
| 117 std::string()); | 109 std::string()); |
| 118 | 110 |
| 119 scoped_ptr<HttpAuthHandler> realm3_digest_handler( | 111 scoped_ptr<HttpAuthHandler> realm3_digest_handler( |
| 120 new MockAuthHandler(HttpAuth::AUTH_SCHEME_DIGEST, | 112 new MockAuthHandler("digest", kRealm3, HttpAuth::AUTH_PROXY)); |
| 121 kRealm3, | |
| 122 HttpAuth::AUTH_PROXY)); | |
| 123 cache.Add(origin, realm3_digest_handler->realm(), | 113 cache.Add(origin, realm3_digest_handler->realm(), |
| 124 realm3_digest_handler->auth_scheme(), "Digest realm=Realm3", | 114 realm3_digest_handler->auth_scheme(), "Digest realm=Realm3", |
| 125 CreateASCIICredentials("realm3-digest-user", | 115 CreateASCIICredentials("realm3-digest-user", |
| 126 "realm3-digest-password"), | 116 "realm3-digest-password"), |
| 127 "/baz/index.html"); | 117 "/baz/index.html"); |
| 128 | 118 |
| 129 scoped_ptr<HttpAuthHandler> realm4_basic_handler( | 119 scoped_ptr<HttpAuthHandler> realm4_basic_handler( |
| 130 new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC, | 120 new MockAuthHandler("basic", kRealm4, HttpAuth::AUTH_SERVER)); |
| 131 kRealm4, | |
| 132 HttpAuth::AUTH_SERVER)); | |
| 133 cache.Add(origin, realm4_basic_handler->realm(), | 121 cache.Add(origin, realm4_basic_handler->realm(), |
| 134 realm4_basic_handler->auth_scheme(), "Basic realm=Realm4", | 122 realm4_basic_handler->auth_scheme(), "Basic realm=Realm4", |
| 135 CreateASCIICredentials("realm4-basic-user", | 123 CreateASCIICredentials("realm4-basic-user", |
| 136 "realm4-basic-password"), | 124 "realm4-basic-password"), |
| 137 "/"); | 125 "/"); |
| 138 | 126 |
| 139 // There is no Realm5 | 127 // There is no Realm5 |
| 140 entry = cache.Lookup(origin, kRealm5, HttpAuth::AUTH_SCHEME_BASIC); | 128 entry = cache.Lookup(origin, kRealm5, "basic"); |
| 141 EXPECT_TRUE(NULL == entry); | 129 EXPECT_TRUE(NULL == entry); |
| 142 | 130 |
| 143 // While Realm3 does exist, the origin scheme is wrong. | 131 // While Realm3 does exist, the origin scheme is wrong. |
| 144 entry = cache.Lookup(GURL("https://www.google.com"), kRealm3, | 132 entry = cache.Lookup(GURL("https://www.google.com"), kRealm3, "basic"); |
| 145 HttpAuth::AUTH_SCHEME_BASIC); | |
| 146 EXPECT_TRUE(NULL == entry); | 133 EXPECT_TRUE(NULL == entry); |
| 147 | 134 |
| 148 // Realm, origin scheme ok, authentication scheme wrong | 135 // Realm, origin scheme ok, authentication scheme wrong |
| 149 entry = cache.Lookup | 136 entry = cache.Lookup(GURL("http://www.google.com"), kRealm1, "digest"); |
| 150 (GURL("http://www.google.com"), kRealm1, HttpAuth::AUTH_SCHEME_DIGEST); | |
| 151 EXPECT_TRUE(NULL == entry); | 137 EXPECT_TRUE(NULL == entry); |
| 152 | 138 |
| 153 // Valid lookup by origin, realm, scheme. | 139 // Valid lookup by origin, realm, scheme. |
| 154 entry = cache.Lookup( | 140 entry = cache.Lookup(GURL("http://www.google.com:80"), kRealm3, "basic"); |
| 155 GURL("http://www.google.com:80"), kRealm3, HttpAuth::AUTH_SCHEME_BASIC); | |
| 156 ASSERT_FALSE(NULL == entry); | 141 ASSERT_FALSE(NULL == entry); |
| 157 EXPECT_EQ(HttpAuth::AUTH_SCHEME_BASIC, entry->scheme()); | 142 EXPECT_EQ("basic", entry->scheme()); |
| 158 EXPECT_EQ(kRealm3, entry->realm()); | 143 EXPECT_EQ(kRealm3, entry->realm()); |
| 159 EXPECT_EQ("Basic realm=Realm3", entry->auth_challenge()); | 144 EXPECT_EQ("Basic realm=Realm3", entry->auth_challenge()); |
| 160 EXPECT_EQ(ASCIIToUTF16("realm3-basic-user"), entry->credentials().username()); | 145 EXPECT_EQ(ASCIIToUTF16("realm3-basic-user"), entry->credentials().username()); |
| 161 EXPECT_EQ(ASCIIToUTF16("realm3-basic-password"), | 146 EXPECT_EQ(ASCIIToUTF16("realm3-basic-password"), |
| 162 entry->credentials().password()); | 147 entry->credentials().password()); |
| 163 | 148 |
| 164 // Valid lookup by origin, realm, scheme when there's a duplicate | 149 // Valid lookup by origin, realm, scheme when there's a duplicate |
| 165 // origin, realm in the cache | 150 // origin, realm in the cache |
| 166 entry = cache.Lookup( | 151 entry = cache.Lookup(GURL("http://www.google.com:80"), kRealm3, "digest"); |
| 167 GURL("http://www.google.com:80"), kRealm3, HttpAuth::AUTH_SCHEME_DIGEST); | |
| 168 ASSERT_FALSE(NULL == entry); | 152 ASSERT_FALSE(NULL == entry); |
| 169 EXPECT_EQ(HttpAuth::AUTH_SCHEME_DIGEST, entry->scheme()); | 153 EXPECT_EQ("digest", entry->scheme()); |
| 170 EXPECT_EQ(kRealm3, entry->realm()); | 154 EXPECT_EQ(kRealm3, entry->realm()); |
| 171 EXPECT_EQ("Digest realm=Realm3", entry->auth_challenge()); | 155 EXPECT_EQ("Digest realm=Realm3", entry->auth_challenge()); |
| 172 EXPECT_EQ(ASCIIToUTF16("realm3-digest-user"), | 156 EXPECT_EQ(ASCIIToUTF16("realm3-digest-user"), |
| 173 entry->credentials().username()); | 157 entry->credentials().username()); |
| 174 EXPECT_EQ(ASCIIToUTF16("realm3-digest-password"), | 158 EXPECT_EQ(ASCIIToUTF16("realm3-digest-password"), |
| 175 entry->credentials().password()); | 159 entry->credentials().password()); |
| 176 | 160 |
| 177 // Valid lookup by realm. | 161 // Valid lookup by realm. |
| 178 entry = cache.Lookup(origin, kRealm2, HttpAuth::AUTH_SCHEME_BASIC); | 162 entry = cache.Lookup(origin, kRealm2, "basic"); |
| 179 ASSERT_FALSE(NULL == entry); | 163 ASSERT_FALSE(NULL == entry); |
| 180 EXPECT_EQ(HttpAuth::AUTH_SCHEME_BASIC, entry->scheme()); | 164 EXPECT_EQ("basic", entry->scheme()); |
| 181 EXPECT_EQ(kRealm2, entry->realm()); | 165 EXPECT_EQ(kRealm2, entry->realm()); |
| 182 EXPECT_EQ("Basic realm=Realm2", entry->auth_challenge()); | 166 EXPECT_EQ("Basic realm=Realm2", entry->auth_challenge()); |
| 183 EXPECT_EQ(ASCIIToUTF16("realm2-user"), entry->credentials().username()); | 167 EXPECT_EQ(ASCIIToUTF16("realm2-user"), entry->credentials().username()); |
| 184 EXPECT_EQ(ASCIIToUTF16("realm2-password"), entry->credentials().password()); | 168 EXPECT_EQ(ASCIIToUTF16("realm2-password"), entry->credentials().password()); |
| 185 | 169 |
| 186 // Check that subpaths are recognized. | 170 // Check that subpaths are recognized. |
| 187 HttpAuthCache::Entry* realm2_entry = cache.Lookup( | 171 HttpAuthCache::Entry* realm2_entry = cache.Lookup(origin, kRealm2, "basic"); |
| 188 origin, kRealm2, HttpAuth::AUTH_SCHEME_BASIC); | 172 HttpAuthCache::Entry* realm4_entry = cache.Lookup(origin, kRealm4, "basic"); |
| 189 HttpAuthCache::Entry* realm4_entry = cache.Lookup( | |
| 190 origin, kRealm4, HttpAuth::AUTH_SCHEME_BASIC); | |
| 191 EXPECT_FALSE(NULL == realm2_entry); | 173 EXPECT_FALSE(NULL == realm2_entry); |
| 192 EXPECT_FALSE(NULL == realm4_entry); | 174 EXPECT_FALSE(NULL == realm4_entry); |
| 193 // Realm4 applies to '/' and Realm2 applies to '/foo2/'. | 175 // Realm4 applies to '/' and Realm2 applies to '/foo2/'. |
| 194 // LookupByPath() should return the closest enclosing path. | 176 // LookupByPath() should return the closest enclosing path. |
| 195 // Positive tests: | 177 // Positive tests: |
| 196 entry = cache.LookupByPath(origin, "/foo2/index.html"); | 178 entry = cache.LookupByPath(origin, "/foo2/index.html"); |
| 197 EXPECT_TRUE(realm2_entry == entry); | 179 EXPECT_TRUE(realm2_entry == entry); |
| 198 entry = cache.LookupByPath(origin, "/foo2/foobar.html"); | 180 entry = cache.LookupByPath(origin, "/foo2/foobar.html"); |
| 199 EXPECT_TRUE(realm2_entry == entry); | 181 EXPECT_TRUE(realm2_entry == entry); |
| 200 entry = cache.LookupByPath(origin, "/foo2/bar/index.html"); | 182 entry = cache.LookupByPath(origin, "/foo2/bar/index.html"); |
| 201 EXPECT_TRUE(realm2_entry == entry); | 183 EXPECT_TRUE(realm2_entry == entry); |
| 202 entry = cache.LookupByPath(origin, "/foo2/"); | 184 entry = cache.LookupByPath(origin, "/foo2/"); |
| 203 EXPECT_TRUE(realm2_entry == entry); | 185 EXPECT_TRUE(realm2_entry == entry); |
| 204 entry = cache.LookupByPath(origin, "/foo2"); | 186 entry = cache.LookupByPath(origin, "/foo2"); |
| 205 EXPECT_TRUE(realm4_entry == entry); | 187 EXPECT_TRUE(realm4_entry == entry); |
| 206 entry = cache.LookupByPath(origin, "/"); | 188 entry = cache.LookupByPath(origin, "/"); |
| 207 EXPECT_TRUE(realm4_entry == entry); | 189 EXPECT_TRUE(realm4_entry == entry); |
| 208 | 190 |
| 209 // Negative tests: | 191 // Negative tests: |
| 210 entry = cache.LookupByPath(origin, "/foo3/index.html"); | 192 entry = cache.LookupByPath(origin, "/foo3/index.html"); |
| 211 EXPECT_FALSE(realm2_entry == entry); | 193 EXPECT_FALSE(realm2_entry == entry); |
| 212 entry = cache.LookupByPath(origin, std::string()); | 194 entry = cache.LookupByPath(origin, std::string()); |
| 213 EXPECT_FALSE(realm2_entry == entry); | 195 EXPECT_FALSE(realm2_entry == entry); |
| 214 | 196 |
| 215 // Confirm we find the same realm, different auth scheme by path lookup | 197 // Confirm we find the same realm, different auth scheme by path lookup |
| 216 HttpAuthCache::Entry* realm3_digest_entry = | 198 HttpAuthCache::Entry* realm3_digest_entry = |
| 217 cache.Lookup(origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST); | 199 cache.Lookup(origin, kRealm3, "digest"); |
| 218 EXPECT_FALSE(NULL == realm3_digest_entry); | 200 EXPECT_FALSE(NULL == realm3_digest_entry); |
| 219 entry = cache.LookupByPath(origin, "/baz/index.html"); | 201 entry = cache.LookupByPath(origin, "/baz/index.html"); |
| 220 EXPECT_TRUE(realm3_digest_entry == entry); | 202 EXPECT_TRUE(realm3_digest_entry == entry); |
| 221 entry = cache.LookupByPath(origin, "/baz/"); | 203 entry = cache.LookupByPath(origin, "/baz/"); |
| 222 EXPECT_TRUE(realm3_digest_entry == entry); | 204 EXPECT_TRUE(realm3_digest_entry == entry); |
| 223 entry = cache.LookupByPath(origin, "/baz"); | 205 entry = cache.LookupByPath(origin, "/baz"); |
| 224 EXPECT_FALSE(realm3_digest_entry == entry); | 206 EXPECT_FALSE(realm3_digest_entry == entry); |
| 225 | 207 |
| 226 // Confirm we find the same realm, different auth scheme by path lookup | 208 // Confirm we find the same realm, different auth scheme by path lookup |
| 227 HttpAuthCache::Entry* realm3DigestEntry = | 209 HttpAuthCache::Entry* realm3DigestEntry = |
| 228 cache.Lookup(origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST); | 210 cache.Lookup(origin, kRealm3, "digest"); |
| 229 EXPECT_FALSE(NULL == realm3DigestEntry); | 211 EXPECT_FALSE(NULL == realm3DigestEntry); |
| 230 entry = cache.LookupByPath(origin, "/baz/index.html"); | 212 entry = cache.LookupByPath(origin, "/baz/index.html"); |
| 231 EXPECT_TRUE(realm3DigestEntry == entry); | 213 EXPECT_TRUE(realm3DigestEntry == entry); |
| 232 entry = cache.LookupByPath(origin, "/baz/"); | 214 entry = cache.LookupByPath(origin, "/baz/"); |
| 233 EXPECT_TRUE(realm3DigestEntry == entry); | 215 EXPECT_TRUE(realm3DigestEntry == entry); |
| 234 entry = cache.LookupByPath(origin, "/baz"); | 216 entry = cache.LookupByPath(origin, "/baz"); |
| 235 EXPECT_FALSE(realm3DigestEntry == entry); | 217 EXPECT_FALSE(realm3DigestEntry == entry); |
| 236 | 218 |
| 237 // Lookup using empty path (may be used for proxy). | 219 // Lookup using empty path (may be used for proxy). |
| 238 entry = cache.LookupByPath(origin, std::string()); | 220 entry = cache.LookupByPath(origin, std::string()); |
| 239 EXPECT_FALSE(NULL == entry); | 221 EXPECT_FALSE(NULL == entry); |
| 240 EXPECT_EQ(HttpAuth::AUTH_SCHEME_BASIC, entry->scheme()); | 222 EXPECT_EQ("basic", entry->scheme()); |
| 241 EXPECT_EQ(kRealm3, entry->realm()); | 223 EXPECT_EQ(kRealm3, entry->realm()); |
| 242 } | 224 } |
| 243 | 225 |
| 244 TEST(HttpAuthCacheTest, AddPath) { | 226 TEST(HttpAuthCacheTest, AddPath) { |
| 245 HttpAuthCache::Entry entry; | 227 HttpAuthCache::Entry entry; |
| 246 | 228 |
| 247 // All of these paths have a common root /1/2/2/4/5/ | 229 // All of these paths have a common root /1/2/2/4/5/ |
| 248 entry.AddPath("/1/2/3/4/5/x.txt"); | 230 entry.AddPath("/1/2/3/4/5/x.txt"); |
| 249 entry.AddPath("/1/2/3/4/5/y.txt"); | 231 entry.AddPath("/1/2/3/4/5/y.txt"); |
| 250 entry.AddPath("/1/2/3/4/5/z.txt"); | 232 entry.AddPath("/1/2/3/4/5/z.txt"); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 274 } | 256 } |
| 275 | 257 |
| 276 // Calling Add when the realm entry already exists, should append that | 258 // Calling Add when the realm entry already exists, should append that |
| 277 // path. | 259 // path. |
| 278 TEST(HttpAuthCacheTest, AddToExistingEntry) { | 260 TEST(HttpAuthCacheTest, AddToExistingEntry) { |
| 279 HttpAuthCache cache; | 261 HttpAuthCache cache; |
| 280 GURL origin("http://www.foobar.com:70"); | 262 GURL origin("http://www.foobar.com:70"); |
| 281 const std::string auth_challenge = "Basic realm=MyRealm"; | 263 const std::string auth_challenge = "Basic realm=MyRealm"; |
| 282 | 264 |
| 283 scoped_ptr<HttpAuthHandler> handler( | 265 scoped_ptr<HttpAuthHandler> handler( |
| 284 new MockAuthHandler( | 266 new MockAuthHandler("basic", "MyRealm", HttpAuth::AUTH_SERVER)); |
| 285 HttpAuth::AUTH_SCHEME_BASIC, "MyRealm", HttpAuth::AUTH_SERVER)); | |
| 286 HttpAuthCache::Entry* orig_entry = cache.Add( | 267 HttpAuthCache::Entry* orig_entry = cache.Add( |
| 287 origin, handler->realm(), handler->auth_scheme(), auth_challenge, | 268 origin, handler->realm(), handler->auth_scheme(), auth_challenge, |
| 288 CreateASCIICredentials("user1", "password1"), "/x/y/z/"); | 269 CreateASCIICredentials("user1", "password1"), "/x/y/z/"); |
| 289 cache.Add(origin, handler->realm(), handler->auth_scheme(), auth_challenge, | 270 cache.Add(origin, handler->realm(), handler->auth_scheme(), auth_challenge, |
| 290 CreateASCIICredentials("user2", "password2"), "/z/y/x/"); | 271 CreateASCIICredentials("user2", "password2"), "/z/y/x/"); |
| 291 cache.Add(origin, handler->realm(), handler->auth_scheme(), auth_challenge, | 272 cache.Add(origin, handler->realm(), handler->auth_scheme(), auth_challenge, |
| 292 CreateASCIICredentials("user3", "password3"), "/z/y"); | 273 CreateASCIICredentials("user3", "password3"), "/z/y"); |
| 293 | 274 |
| 294 HttpAuthCache::Entry* entry = cache.Lookup( | 275 HttpAuthCache::Entry* entry = cache.Lookup(origin, "MyRealm", "basic"); |
| 295 origin, "MyRealm", HttpAuth::AUTH_SCHEME_BASIC); | |
| 296 | 276 |
| 297 EXPECT_TRUE(entry == orig_entry); | 277 ASSERT_TRUE(entry == orig_entry); |
| 298 EXPECT_EQ(ASCIIToUTF16("user3"), entry->credentials().username()); | 278 EXPECT_EQ(ASCIIToUTF16("user3"), entry->credentials().username()); |
| 299 EXPECT_EQ(ASCIIToUTF16("password3"), entry->credentials().password()); | 279 EXPECT_EQ(ASCIIToUTF16("password3"), entry->credentials().password()); |
| 300 | 280 |
| 301 EXPECT_EQ(2U, entry->paths_.size()); | 281 EXPECT_EQ(2U, entry->paths_.size()); |
| 302 EXPECT_EQ("/z/", entry->paths_.front()); | 282 EXPECT_EQ("/z/", entry->paths_.front()); |
| 303 EXPECT_EQ("/x/y/z/", entry->paths_.back()); | 283 EXPECT_EQ("/x/y/z/", entry->paths_.back()); |
| 304 } | 284 } |
| 305 | 285 |
| 306 TEST(HttpAuthCacheTest, Remove) { | 286 TEST(HttpAuthCacheTest, Remove) { |
| 307 GURL origin("http://foobar2.com"); | 287 GURL origin("http://foobar2.com"); |
| 308 | 288 |
| 309 scoped_ptr<HttpAuthHandler> realm1_handler( | 289 scoped_ptr<HttpAuthHandler> realm1_handler( |
| 310 new MockAuthHandler( | 290 new MockAuthHandler("basic", kRealm1, HttpAuth::AUTH_SERVER)); |
| 311 HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER)); | |
| 312 | 291 |
| 313 scoped_ptr<HttpAuthHandler> realm2_handler( | 292 scoped_ptr<HttpAuthHandler> realm2_handler( |
| 314 new MockAuthHandler( | 293 new MockAuthHandler("basic", kRealm2, HttpAuth::AUTH_SERVER)); |
| 315 HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_SERVER)); | |
| 316 | 294 |
| 317 scoped_ptr<HttpAuthHandler> realm3_basic_handler( | 295 scoped_ptr<HttpAuthHandler> realm3_basic_handler( |
| 318 new MockAuthHandler( | 296 new MockAuthHandler("basic", kRealm3, HttpAuth::AUTH_SERVER)); |
| 319 HttpAuth::AUTH_SCHEME_BASIC, kRealm3, HttpAuth::AUTH_SERVER)); | |
| 320 | 297 |
| 321 scoped_ptr<HttpAuthHandler> realm3_digest_handler( | 298 scoped_ptr<HttpAuthHandler> realm3_digest_handler( |
| 322 new MockAuthHandler( | 299 new MockAuthHandler("digest", kRealm3, HttpAuth::AUTH_SERVER)); |
| 323 HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_SERVER)); | |
| 324 | 300 |
| 325 HttpAuthCache cache; | 301 HttpAuthCache cache; |
| 326 cache.Add(origin, realm1_handler->realm(), realm1_handler->auth_scheme(), | 302 cache.Add(origin, realm1_handler->realm(), realm1_handler->auth_scheme(), |
| 327 "basic realm=Realm1", AuthCredentials(kAlice, k123), "/"); | 303 "basic realm=Realm1", AuthCredentials(kAlice, k123), "/"); |
| 328 cache.Add(origin, realm2_handler->realm(), realm2_handler->auth_scheme(), | 304 cache.Add(origin, realm2_handler->realm(), realm2_handler->auth_scheme(), |
| 329 "basic realm=Realm2", CreateASCIICredentials("bob", "princess"), | 305 "basic realm=Realm2", CreateASCIICredentials("bob", "princess"), |
| 330 "/"); | 306 "/"); |
| 331 cache.Add(origin, realm3_basic_handler->realm(), | 307 cache.Add(origin, realm3_basic_handler->realm(), |
| 332 realm3_basic_handler->auth_scheme(), "basic realm=Realm3", | 308 realm3_basic_handler->auth_scheme(), "basic realm=Realm3", |
| 333 AuthCredentials(kAdmin, kPassword), "/"); | 309 AuthCredentials(kAdmin, kPassword), "/"); |
| 334 cache.Add(origin, realm3_digest_handler->realm(), | 310 cache.Add(origin, realm3_digest_handler->realm(), |
| 335 realm3_digest_handler->auth_scheme(), "digest realm=Realm3", | 311 realm3_digest_handler->auth_scheme(), "digest realm=Realm3", |
| 336 AuthCredentials(kRoot, kWileCoyote), "/"); | 312 AuthCredentials(kRoot, kWileCoyote), "/"); |
| 337 | 313 |
| 338 // Fails, because there is no realm "Realm5". | 314 // Fails, because there is no realm "Realm5". |
| 339 EXPECT_FALSE(cache.Remove( | 315 EXPECT_FALSE( |
| 340 origin, kRealm5, HttpAuth::AUTH_SCHEME_BASIC, | 316 cache.Remove(origin, kRealm5, "basic", AuthCredentials(kAlice, k123))); |
| 341 AuthCredentials(kAlice, k123))); | |
| 342 | 317 |
| 343 // Fails because the origin is wrong. | 318 // Fails because the origin is wrong. |
| 344 EXPECT_FALSE(cache.Remove(GURL("http://foobar2.com:100"), | 319 EXPECT_FALSE(cache.Remove(GURL("http://foobar2.com:100"), kRealm1, "basic", |
| 345 kRealm1, | |
| 346 HttpAuth::AUTH_SCHEME_BASIC, | |
| 347 AuthCredentials(kAlice, k123))); | 320 AuthCredentials(kAlice, k123))); |
| 348 | 321 |
| 349 // Fails because the username is wrong. | 322 // Fails because the username is wrong. |
| 350 EXPECT_FALSE(cache.Remove( | 323 EXPECT_FALSE( |
| 351 origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC, | 324 cache.Remove(origin, kRealm1, "basic", AuthCredentials(kAlice2, k123))); |
| 352 AuthCredentials(kAlice2, k123))); | |
| 353 | 325 |
| 354 // Fails because the password is wrong. | 326 // Fails because the password is wrong. |
| 355 EXPECT_FALSE(cache.Remove( | 327 EXPECT_FALSE( |
| 356 origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC, | 328 cache.Remove(origin, kRealm1, "basic", AuthCredentials(kAlice, k1234))); |
| 357 AuthCredentials(kAlice, k1234))); | |
| 358 | 329 |
| 359 // Fails because the authentication type is wrong. | 330 // Fails because the authentication type is wrong. |
| 360 EXPECT_FALSE(cache.Remove( | 331 EXPECT_FALSE( |
| 361 origin, kRealm1, HttpAuth::AUTH_SCHEME_DIGEST, | 332 cache.Remove(origin, kRealm1, "digest", AuthCredentials(kAlice, k123))); |
| 362 AuthCredentials(kAlice, k123))); | |
| 363 | 333 |
| 364 // Succeeds. | 334 // Succeeds. |
| 365 EXPECT_TRUE(cache.Remove( | 335 EXPECT_TRUE( |
| 366 origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC, | 336 cache.Remove(origin, kRealm1, "basic", AuthCredentials(kAlice, k123))); |
| 367 AuthCredentials(kAlice, k123))); | |
| 368 | 337 |
| 369 // Fails because we just deleted the entry! | 338 // Fails because we just deleted the entry! |
| 370 EXPECT_FALSE(cache.Remove( | 339 EXPECT_FALSE( |
| 371 origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC, | 340 cache.Remove(origin, kRealm1, "basic", AuthCredentials(kAlice, k123))); |
| 372 AuthCredentials(kAlice, k123))); | |
| 373 | 341 |
| 374 // Succeed when there are two authentication types for the same origin,realm. | 342 // Succeed when there are two authentication types for the same origin,realm. |
| 375 EXPECT_TRUE(cache.Remove( | 343 EXPECT_TRUE(cache.Remove(origin, kRealm3, "digest", |
| 376 origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST, | 344 AuthCredentials(kRoot, kWileCoyote))); |
| 377 AuthCredentials(kRoot, kWileCoyote))); | |
| 378 | 345 |
| 379 // Succeed as above, but when entries were added in opposite order | 346 // Succeed as above, but when entries were added in opposite order |
| 380 cache.Add(origin, realm3_digest_handler->realm(), | 347 cache.Add(origin, realm3_digest_handler->realm(), |
| 381 realm3_digest_handler->auth_scheme(), "digest realm=Realm3", | 348 realm3_digest_handler->auth_scheme(), "digest realm=Realm3", |
| 382 AuthCredentials(kRoot, kWileCoyote), "/"); | 349 AuthCredentials(kRoot, kWileCoyote), "/"); |
| 383 EXPECT_TRUE(cache.Remove( | 350 EXPECT_TRUE(cache.Remove(origin, kRealm3, "basic", |
| 384 origin, kRealm3, HttpAuth::AUTH_SCHEME_BASIC, | 351 AuthCredentials(kAdmin, kPassword))); |
| 385 AuthCredentials(kAdmin, kPassword))); | |
| 386 | 352 |
| 387 // Make sure that removing one entry still leaves the other available for | 353 // Make sure that removing one entry still leaves the other available for |
| 388 // lookup. | 354 // lookup. |
| 389 HttpAuthCache::Entry* entry = cache.Lookup( | 355 HttpAuthCache::Entry* entry = cache.Lookup(origin, kRealm3, "digest"); |
| 390 origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST); | |
| 391 EXPECT_FALSE(NULL == entry); | 356 EXPECT_FALSE(NULL == entry); |
| 392 } | 357 } |
| 393 | 358 |
| 394 TEST(HttpAuthCacheTest, UpdateStaleChallenge) { | 359 TEST(HttpAuthCacheTest, UpdateStaleChallenge) { |
| 395 HttpAuthCache cache; | 360 HttpAuthCache cache; |
| 396 GURL origin("http://foobar2.com"); | 361 GURL origin("http://foobar2.com"); |
| 397 scoped_ptr<HttpAuthHandler> digest_handler( | 362 scoped_ptr<HttpAuthHandler> digest_handler( |
| 398 new MockAuthHandler( | 363 new MockAuthHandler("digest", kRealm1, HttpAuth::AUTH_PROXY)); |
| 399 HttpAuth::AUTH_SCHEME_DIGEST, kRealm1, HttpAuth::AUTH_PROXY)); | |
| 400 HttpAuthCache::Entry* entry_pre = cache.Add( | 364 HttpAuthCache::Entry* entry_pre = cache.Add( |
| 401 origin, | 365 origin, |
| 402 digest_handler->realm(), | 366 digest_handler->realm(), |
| 403 digest_handler->auth_scheme(), | 367 digest_handler->auth_scheme(), |
| 404 "Digest realm=Realm1," | 368 "Digest realm=Realm1," |
| 405 "nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\"", | 369 "nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\"", |
| 406 CreateASCIICredentials("realm-digest-user", "realm-digest-password"), | 370 CreateASCIICredentials("realm-digest-user", "realm-digest-password"), |
| 407 "/baz/index.html"); | 371 "/baz/index.html"); |
| 408 ASSERT_TRUE(entry_pre != NULL); | 372 ASSERT_TRUE(entry_pre != NULL); |
| 409 | 373 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 439 "stale=\"true\""); | 403 "stale=\"true\""); |
| 440 EXPECT_FALSE(update_failure); | 404 EXPECT_FALSE(update_failure); |
| 441 } | 405 } |
| 442 | 406 |
| 443 TEST(HttpAuthCacheTest, UpdateAllFrom) { | 407 TEST(HttpAuthCacheTest, UpdateAllFrom) { |
| 444 GURL origin("http://example.com"); | 408 GURL origin("http://example.com"); |
| 445 std::string path("/some/path"); | 409 std::string path("/some/path"); |
| 446 std::string another_path("/another/path"); | 410 std::string another_path("/another/path"); |
| 447 | 411 |
| 448 scoped_ptr<HttpAuthHandler> realm1_handler( | 412 scoped_ptr<HttpAuthHandler> realm1_handler( |
| 449 new MockAuthHandler( | 413 new MockAuthHandler("basic", kRealm1, HttpAuth::AUTH_SERVER)); |
| 450 HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER)); | |
| 451 | 414 |
| 452 scoped_ptr<HttpAuthHandler> realm2_handler( | 415 scoped_ptr<HttpAuthHandler> realm2_handler( |
| 453 new MockAuthHandler( | 416 new MockAuthHandler("basic", kRealm2, HttpAuth::AUTH_PROXY)); |
| 454 HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_PROXY)); | |
| 455 | 417 |
| 456 scoped_ptr<HttpAuthHandler> realm3_digest_handler( | 418 scoped_ptr<HttpAuthHandler> realm3_digest_handler( |
| 457 new MockAuthHandler( | 419 new MockAuthHandler("digest", kRealm3, HttpAuth::AUTH_SERVER)); |
| 458 HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_SERVER)); | |
| 459 | 420 |
| 460 scoped_ptr<HttpAuthHandler> realm4_handler( | 421 scoped_ptr<HttpAuthHandler> realm4_handler( |
| 461 new MockAuthHandler( | 422 new MockAuthHandler("basic", kRealm4, HttpAuth::AUTH_SERVER)); |
| 462 HttpAuth::AUTH_SCHEME_BASIC, kRealm4, HttpAuth::AUTH_SERVER)); | |
| 463 | 423 |
| 464 HttpAuthCache first_cache; | 424 HttpAuthCache first_cache; |
| 465 HttpAuthCache::Entry* entry; | 425 HttpAuthCache::Entry* entry; |
| 466 | 426 |
| 467 first_cache.Add(origin, realm1_handler->realm(), | 427 first_cache.Add(origin, realm1_handler->realm(), |
| 468 realm1_handler->auth_scheme(), "basic realm=Realm1", | 428 realm1_handler->auth_scheme(), "basic realm=Realm1", |
| 469 AuthCredentials(kAlice, k123), path); | 429 AuthCredentials(kAlice, k123), path); |
| 470 first_cache.Add(origin, realm2_handler->realm(), | 430 first_cache.Add(origin, realm2_handler->realm(), |
| 471 realm2_handler->auth_scheme(), "basic realm=Realm2", | 431 realm2_handler->auth_scheme(), "basic realm=Realm2", |
| 472 AuthCredentials(kAlice2, k1234), path); | 432 AuthCredentials(kAlice2, k1234), path); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 486 realm3_digest_handler->auth_scheme(), "digest realm=Realm3", | 446 realm3_digest_handler->auth_scheme(), "digest realm=Realm3", |
| 487 AuthCredentials(kAlice2, k1234), path); | 447 AuthCredentials(kAlice2, k1234), path); |
| 488 // Should be left intact. | 448 // Should be left intact. |
| 489 second_cache.Add(origin, realm4_handler->realm(), | 449 second_cache.Add(origin, realm4_handler->realm(), |
| 490 realm4_handler->auth_scheme(), "basic realm=Realm4", | 450 realm4_handler->auth_scheme(), "basic realm=Realm4", |
| 491 AuthCredentials(kAdmin, kRoot), path); | 451 AuthCredentials(kAdmin, kRoot), path); |
| 492 | 452 |
| 493 second_cache.UpdateAllFrom(first_cache); | 453 second_cache.UpdateAllFrom(first_cache); |
| 494 | 454 |
| 495 // Copied from first_cache. | 455 // Copied from first_cache. |
| 496 entry = second_cache.Lookup(origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC); | 456 entry = second_cache.Lookup(origin, kRealm1, "basic"); |
| 497 EXPECT_TRUE(NULL != entry); | 457 EXPECT_TRUE(NULL != entry); |
| 498 EXPECT_EQ(kAlice, entry->credentials().username()); | 458 EXPECT_EQ(kAlice, entry->credentials().username()); |
| 499 EXPECT_EQ(k123, entry->credentials().password()); | 459 EXPECT_EQ(k123, entry->credentials().password()); |
| 500 | 460 |
| 501 // Copied from first_cache. | 461 // Copied from first_cache. |
| 502 entry = second_cache.Lookup(origin, kRealm2, HttpAuth::AUTH_SCHEME_BASIC); | 462 entry = second_cache.Lookup(origin, kRealm2, "basic"); |
| 503 EXPECT_TRUE(NULL != entry); | 463 EXPECT_TRUE(NULL != entry); |
| 504 EXPECT_EQ(kAlice2, entry->credentials().username()); | 464 EXPECT_EQ(kAlice2, entry->credentials().username()); |
| 505 EXPECT_EQ(k1234, entry->credentials().password()); | 465 EXPECT_EQ(k1234, entry->credentials().password()); |
| 506 | 466 |
| 507 // Overwritten from first_cache. | 467 // Overwritten from first_cache. |
| 508 entry = second_cache.Lookup(origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST); | 468 entry = second_cache.Lookup(origin, kRealm3, "digest"); |
| 509 EXPECT_TRUE(NULL != entry); | 469 EXPECT_TRUE(NULL != entry); |
| 510 EXPECT_EQ(kRoot, entry->credentials().username()); | 470 EXPECT_EQ(kRoot, entry->credentials().username()); |
| 511 EXPECT_EQ(kWileCoyote, entry->credentials().password()); | 471 EXPECT_EQ(kWileCoyote, entry->credentials().password()); |
| 512 // Nonce count should get copied. | 472 // Nonce count should get copied. |
| 513 EXPECT_EQ(3, entry->IncrementNonceCount()); | 473 EXPECT_EQ(3, entry->IncrementNonceCount()); |
| 514 | 474 |
| 515 // All paths should get copied. | 475 // All paths should get copied. |
| 516 entry = second_cache.LookupByPath(origin, another_path); | 476 entry = second_cache.LookupByPath(origin, another_path); |
| 517 EXPECT_TRUE(NULL != entry); | 477 EXPECT_TRUE(NULL != entry); |
| 518 EXPECT_EQ(kRoot, entry->credentials().username()); | 478 EXPECT_EQ(kRoot, entry->credentials().username()); |
| 519 EXPECT_EQ(kWileCoyote, entry->credentials().password()); | 479 EXPECT_EQ(kWileCoyote, entry->credentials().password()); |
| 520 | 480 |
| 521 // Left intact in second_cache. | 481 // Left intact in second_cache. |
| 522 entry = second_cache.Lookup(origin, kRealm4, HttpAuth::AUTH_SCHEME_BASIC); | 482 entry = second_cache.Lookup(origin, kRealm4, "basic"); |
| 523 EXPECT_TRUE(NULL != entry); | 483 EXPECT_TRUE(NULL != entry); |
| 524 EXPECT_EQ(kAdmin, entry->credentials().username()); | 484 EXPECT_EQ(kAdmin, entry->credentials().username()); |
| 525 EXPECT_EQ(kRoot, entry->credentials().password()); | 485 EXPECT_EQ(kRoot, entry->credentials().password()); |
| 526 } | 486 } |
| 527 | 487 |
| 528 // Test fixture class for eviction tests (contains helpers for bulk | 488 // Test fixture class for eviction tests (contains helpers for bulk |
| 529 // insertion and existence testing). | 489 // insertion and existence testing). |
| 530 class HttpAuthCacheEvictionTest : public testing::Test { | 490 class HttpAuthCacheEvictionTest : public testing::Test { |
| 531 protected: | 491 protected: |
| 532 HttpAuthCacheEvictionTest() : origin_("http://www.google.com") { } | 492 HttpAuthCacheEvictionTest() : origin_("http://www.google.com") { } |
| 533 | 493 |
| 534 std::string GenerateRealm(int realm_i) { | 494 std::string GenerateRealm(int realm_i) { |
| 535 return base::StringPrintf("Realm %d", realm_i); | 495 return base::StringPrintf("Realm %d", realm_i); |
| 536 } | 496 } |
| 537 | 497 |
| 538 std::string GeneratePath(int realm_i, int path_i) { | 498 std::string GeneratePath(int realm_i, int path_i) { |
| 539 return base::StringPrintf("/%d/%d/x/y", realm_i, path_i); | 499 return base::StringPrintf("/%d/%d/x/y", realm_i, path_i); |
| 540 } | 500 } |
| 541 | 501 |
| 542 void AddRealm(int realm_i) { | 502 void AddRealm(int realm_i) { |
| 543 AddPathToRealm(realm_i, 0); | 503 AddPathToRealm(realm_i, 0); |
| 544 } | 504 } |
| 545 | 505 |
| 546 void AddPathToRealm(int realm_i, int path_i) { | 506 void AddPathToRealm(int realm_i, int path_i) { |
| 547 cache_.Add(origin_, | 507 cache_.Add(origin_, GenerateRealm(realm_i), "basic", std::string(), |
| 548 GenerateRealm(realm_i), | |
| 549 HttpAuth::AUTH_SCHEME_BASIC, | |
| 550 std::string(), | |
| 551 AuthCredentials(kUsername, kPassword), | 508 AuthCredentials(kUsername, kPassword), |
| 552 GeneratePath(realm_i, path_i)); | 509 GeneratePath(realm_i, path_i)); |
| 553 } | 510 } |
| 554 | 511 |
| 555 void CheckRealmExistence(int realm_i, bool exists) { | 512 void CheckRealmExistence(int realm_i, bool exists) { |
| 556 const HttpAuthCache::Entry* entry = | 513 const HttpAuthCache::Entry* entry = |
| 557 cache_.Lookup( | 514 cache_.Lookup(origin_, GenerateRealm(realm_i), "basic"); |
| 558 origin_, GenerateRealm(realm_i), HttpAuth::AUTH_SCHEME_BASIC); | |
| 559 if (exists) { | 515 if (exists) { |
| 560 EXPECT_FALSE(entry == NULL); | 516 EXPECT_FALSE(entry == NULL); |
| 561 EXPECT_EQ(GenerateRealm(realm_i), entry->realm()); | 517 EXPECT_EQ(GenerateRealm(realm_i), entry->realm()); |
| 562 } else { | 518 } else { |
| 563 EXPECT_TRUE(entry == NULL); | 519 EXPECT_TRUE(entry == NULL); |
| 564 } | 520 } |
| 565 } | 521 } |
| 566 | 522 |
| 567 void CheckPathExistence(int realm_i, int path_i, bool exists) { | 523 void CheckPathExistence(int realm_i, int path_i, bool exists) { |
| 568 const HttpAuthCache::Entry* entry = | 524 const HttpAuthCache::Entry* entry = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 CheckPathExistence(0, i, false); | 575 CheckPathExistence(0, i, false); |
| 620 | 576 |
| 621 for (int i = 0; i < kMaxPaths; ++i) | 577 for (int i = 0; i < kMaxPaths; ++i) |
| 622 CheckPathExistence(0, i + 3, true); | 578 CheckPathExistence(0, i + 3, true); |
| 623 | 579 |
| 624 for (int i = 0; i < kMaxRealms; ++i) | 580 for (int i = 0; i < kMaxRealms; ++i) |
| 625 CheckRealmExistence(i, true); | 581 CheckRealmExistence(i, true); |
| 626 } | 582 } |
| 627 | 583 |
| 628 } // namespace net | 584 } // namespace net |
| OLD | NEW |