| Index: net/http/http_auth_cache_unittest.cc
|
| diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc
|
| index e925c71431646d8af6bcdb02b0e646577e4496c8..c2f738337aa4f02f493256104ad348d14274f995 100644
|
| --- a/net/http/http_auth_cache_unittest.cc
|
| +++ b/net/http/http_auth_cache_unittest.cc
|
| @@ -50,7 +50,6 @@ class MockAuthHandler : public HttpAuthHandler {
|
| return OK;
|
| }
|
|
|
| -
|
| private:
|
| virtual ~MockAuthHandler() {}
|
| };
|
| @@ -86,28 +85,26 @@ TEST(HttpAuthCacheTest, Basic) {
|
| // Add cache entries for 4 realms: "Realm1", "Realm2", "Realm3" and
|
| // "Realm4"
|
|
|
| - scoped_ptr<HttpAuthHandler> realm1_handler(
|
| - new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC,
|
| - kRealm1,
|
| - HttpAuth::AUTH_SERVER));
|
| - cache.Add(origin, realm1_handler->realm(), realm1_handler->auth_scheme(),
|
| + scoped_ptr<HttpAuthHandler> realm1_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER));
|
| + cache.Add(origin,
|
| + realm1_handler->realm(),
|
| + realm1_handler->auth_scheme(),
|
| "Basic realm=Realm1",
|
| CreateASCIICredentials("realm1-user", "realm1-password"),
|
| "/foo/bar/index.html");
|
|
|
| - scoped_ptr<HttpAuthHandler> realm2_handler(
|
| - new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC,
|
| - kRealm2,
|
| - HttpAuth::AUTH_SERVER));
|
| - cache.Add(origin, realm2_handler->realm(), realm2_handler->auth_scheme(),
|
| + scoped_ptr<HttpAuthHandler> realm2_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_SERVER));
|
| + cache.Add(origin,
|
| + realm2_handler->realm(),
|
| + realm2_handler->auth_scheme(),
|
| "Basic realm=Realm2",
|
| CreateASCIICredentials("realm2-user", "realm2-password"),
|
| "/foo2/index.html");
|
|
|
| - scoped_ptr<HttpAuthHandler> realm3_basic_handler(
|
| - new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC,
|
| - kRealm3,
|
| - HttpAuth::AUTH_PROXY));
|
| + scoped_ptr<HttpAuthHandler> realm3_basic_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm3, HttpAuth::AUTH_PROXY));
|
| cache.Add(
|
| origin,
|
| realm3_basic_handler->realm(),
|
| @@ -116,38 +113,38 @@ TEST(HttpAuthCacheTest, Basic) {
|
| CreateASCIICredentials("realm3-basic-user", "realm3-basic-password"),
|
| std::string());
|
|
|
| - scoped_ptr<HttpAuthHandler> realm3_digest_handler(
|
| - new MockAuthHandler(HttpAuth::AUTH_SCHEME_DIGEST,
|
| - kRealm3,
|
| - HttpAuth::AUTH_PROXY));
|
| - cache.Add(origin, realm3_digest_handler->realm(),
|
| - realm3_digest_handler->auth_scheme(), "Digest realm=Realm3",
|
| - CreateASCIICredentials("realm3-digest-user",
|
| - "realm3-digest-password"),
|
| - "/baz/index.html");
|
| -
|
| - scoped_ptr<HttpAuthHandler> realm4_basic_handler(
|
| - new MockAuthHandler(HttpAuth::AUTH_SCHEME_BASIC,
|
| - kRealm4,
|
| - HttpAuth::AUTH_SERVER));
|
| - cache.Add(origin, realm4_basic_handler->realm(),
|
| - realm4_basic_handler->auth_scheme(), "Basic realm=Realm4",
|
| - CreateASCIICredentials("realm4-basic-user",
|
| - "realm4-basic-password"),
|
| - "/");
|
| + scoped_ptr<HttpAuthHandler> realm3_digest_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_PROXY));
|
| + cache.Add(
|
| + origin,
|
| + realm3_digest_handler->realm(),
|
| + realm3_digest_handler->auth_scheme(),
|
| + "Digest realm=Realm3",
|
| + CreateASCIICredentials("realm3-digest-user", "realm3-digest-password"),
|
| + "/baz/index.html");
|
| +
|
| + scoped_ptr<HttpAuthHandler> realm4_basic_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm4, HttpAuth::AUTH_SERVER));
|
| + cache.Add(
|
| + origin,
|
| + realm4_basic_handler->realm(),
|
| + realm4_basic_handler->auth_scheme(),
|
| + "Basic realm=Realm4",
|
| + CreateASCIICredentials("realm4-basic-user", "realm4-basic-password"),
|
| + "/");
|
|
|
| // There is no Realm5
|
| entry = cache.Lookup(origin, kRealm5, HttpAuth::AUTH_SCHEME_BASIC);
|
| EXPECT_TRUE(NULL == entry);
|
|
|
| // While Realm3 does exist, the origin scheme is wrong.
|
| - entry = cache.Lookup(GURL("https://www.google.com"), kRealm3,
|
| - HttpAuth::AUTH_SCHEME_BASIC);
|
| + entry = cache.Lookup(
|
| + GURL("https://www.google.com"), kRealm3, HttpAuth::AUTH_SCHEME_BASIC);
|
| EXPECT_TRUE(NULL == entry);
|
|
|
| // Realm, origin scheme ok, authentication scheme wrong
|
| - entry = cache.Lookup
|
| - (GURL("http://www.google.com"), kRealm1, HttpAuth::AUTH_SCHEME_DIGEST);
|
| + entry = cache.Lookup(
|
| + GURL("http://www.google.com"), kRealm1, HttpAuth::AUTH_SCHEME_DIGEST);
|
| EXPECT_TRUE(NULL == entry);
|
|
|
| // Valid lookup by origin, realm, scheme.
|
| @@ -184,10 +181,10 @@ TEST(HttpAuthCacheTest, Basic) {
|
| EXPECT_EQ(ASCIIToUTF16("realm2-password"), entry->credentials().password());
|
|
|
| // Check that subpaths are recognized.
|
| - HttpAuthCache::Entry* realm2_entry = cache.Lookup(
|
| - origin, kRealm2, HttpAuth::AUTH_SCHEME_BASIC);
|
| - HttpAuthCache::Entry* realm4_entry = cache.Lookup(
|
| - origin, kRealm4, HttpAuth::AUTH_SCHEME_BASIC);
|
| + HttpAuthCache::Entry* realm2_entry =
|
| + cache.Lookup(origin, kRealm2, HttpAuth::AUTH_SCHEME_BASIC);
|
| + HttpAuthCache::Entry* realm4_entry =
|
| + cache.Lookup(origin, kRealm4, HttpAuth::AUTH_SCHEME_BASIC);
|
| EXPECT_FALSE(NULL == realm2_entry);
|
| EXPECT_FALSE(NULL == realm4_entry);
|
| // Realm4 applies to '/' and Realm2 applies to '/foo2/'.
|
| @@ -280,19 +277,30 @@ TEST(HttpAuthCacheTest, AddToExistingEntry) {
|
| GURL origin("http://www.foobar.com:70");
|
| const std::string auth_challenge = "Basic realm=MyRealm";
|
|
|
| - scoped_ptr<HttpAuthHandler> handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, "MyRealm", HttpAuth::AUTH_SERVER));
|
| - HttpAuthCache::Entry* orig_entry = cache.Add(
|
| - origin, handler->realm(), handler->auth_scheme(), auth_challenge,
|
| - CreateASCIICredentials("user1", "password1"), "/x/y/z/");
|
| - cache.Add(origin, handler->realm(), handler->auth_scheme(), auth_challenge,
|
| - CreateASCIICredentials("user2", "password2"), "/z/y/x/");
|
| - cache.Add(origin, handler->realm(), handler->auth_scheme(), auth_challenge,
|
| - CreateASCIICredentials("user3", "password3"), "/z/y");
|
| -
|
| - HttpAuthCache::Entry* entry = cache.Lookup(
|
| - origin, "MyRealm", HttpAuth::AUTH_SCHEME_BASIC);
|
| + scoped_ptr<HttpAuthHandler> handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, "MyRealm", HttpAuth::AUTH_SERVER));
|
| + HttpAuthCache::Entry* orig_entry =
|
| + cache.Add(origin,
|
| + handler->realm(),
|
| + handler->auth_scheme(),
|
| + auth_challenge,
|
| + CreateASCIICredentials("user1", "password1"),
|
| + "/x/y/z/");
|
| + cache.Add(origin,
|
| + handler->realm(),
|
| + handler->auth_scheme(),
|
| + auth_challenge,
|
| + CreateASCIICredentials("user2", "password2"),
|
| + "/z/y/x/");
|
| + cache.Add(origin,
|
| + handler->realm(),
|
| + handler->auth_scheme(),
|
| + auth_challenge,
|
| + CreateASCIICredentials("user3", "password3"),
|
| + "/z/y");
|
| +
|
| + HttpAuthCache::Entry* entry =
|
| + cache.Lookup(origin, "MyRealm", HttpAuth::AUTH_SCHEME_BASIC);
|
|
|
| EXPECT_TRUE(entry == orig_entry);
|
| EXPECT_EQ(ASCIIToUTF16("user3"), entry->credentials().username());
|
| @@ -306,39 +314,49 @@ TEST(HttpAuthCacheTest, AddToExistingEntry) {
|
| TEST(HttpAuthCacheTest, Remove) {
|
| GURL origin("http://foobar2.com");
|
|
|
| - scoped_ptr<HttpAuthHandler> realm1_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm1_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER));
|
|
|
| - scoped_ptr<HttpAuthHandler> realm2_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm2_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_SERVER));
|
|
|
| - scoped_ptr<HttpAuthHandler> realm3_basic_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, kRealm3, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm3_basic_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm3, HttpAuth::AUTH_SERVER));
|
|
|
| - scoped_ptr<HttpAuthHandler> realm3_digest_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm3_digest_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_SERVER));
|
|
|
| HttpAuthCache cache;
|
| - cache.Add(origin, realm1_handler->realm(), realm1_handler->auth_scheme(),
|
| - "basic realm=Realm1", AuthCredentials(kAlice, k123), "/");
|
| - cache.Add(origin, realm2_handler->realm(), realm2_handler->auth_scheme(),
|
| - "basic realm=Realm2", CreateASCIICredentials("bob", "princess"),
|
| + cache.Add(origin,
|
| + realm1_handler->realm(),
|
| + realm1_handler->auth_scheme(),
|
| + "basic realm=Realm1",
|
| + AuthCredentials(kAlice, k123),
|
| + "/");
|
| + cache.Add(origin,
|
| + realm2_handler->realm(),
|
| + realm2_handler->auth_scheme(),
|
| + "basic realm=Realm2",
|
| + CreateASCIICredentials("bob", "princess"),
|
| + "/");
|
| + cache.Add(origin,
|
| + realm3_basic_handler->realm(),
|
| + realm3_basic_handler->auth_scheme(),
|
| + "basic realm=Realm3",
|
| + AuthCredentials(kAdmin, kPassword),
|
| + "/");
|
| + cache.Add(origin,
|
| + realm3_digest_handler->realm(),
|
| + realm3_digest_handler->auth_scheme(),
|
| + "digest realm=Realm3",
|
| + AuthCredentials(kRoot, kWileCoyote),
|
| "/");
|
| - cache.Add(origin, realm3_basic_handler->realm(),
|
| - realm3_basic_handler->auth_scheme(), "basic realm=Realm3",
|
| - AuthCredentials(kAdmin, kPassword), "/");
|
| - cache.Add(origin, realm3_digest_handler->realm(),
|
| - realm3_digest_handler->auth_scheme(), "digest realm=Realm3",
|
| - AuthCredentials(kRoot, kWileCoyote), "/");
|
|
|
| // Fails, because there is no realm "Realm5".
|
| - EXPECT_FALSE(cache.Remove(
|
| - origin, kRealm5, HttpAuth::AUTH_SCHEME_BASIC,
|
| - AuthCredentials(kAlice, k123)));
|
| + EXPECT_FALSE(cache.Remove(origin,
|
| + kRealm5,
|
| + HttpAuth::AUTH_SCHEME_BASIC,
|
| + AuthCredentials(kAlice, k123)));
|
|
|
| // Fails because the origin is wrong.
|
| EXPECT_FALSE(cache.Remove(GURL("http://foobar2.com:100"),
|
| @@ -347,56 +365,65 @@ TEST(HttpAuthCacheTest, Remove) {
|
| AuthCredentials(kAlice, k123)));
|
|
|
| // Fails because the username is wrong.
|
| - EXPECT_FALSE(cache.Remove(
|
| - origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC,
|
| - AuthCredentials(kAlice2, k123)));
|
| + EXPECT_FALSE(cache.Remove(origin,
|
| + kRealm1,
|
| + HttpAuth::AUTH_SCHEME_BASIC,
|
| + AuthCredentials(kAlice2, k123)));
|
|
|
| // Fails because the password is wrong.
|
| - EXPECT_FALSE(cache.Remove(
|
| - origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC,
|
| - AuthCredentials(kAlice, k1234)));
|
| + EXPECT_FALSE(cache.Remove(origin,
|
| + kRealm1,
|
| + HttpAuth::AUTH_SCHEME_BASIC,
|
| + AuthCredentials(kAlice, k1234)));
|
|
|
| // Fails because the authentication type is wrong.
|
| - EXPECT_FALSE(cache.Remove(
|
| - origin, kRealm1, HttpAuth::AUTH_SCHEME_DIGEST,
|
| - AuthCredentials(kAlice, k123)));
|
| + EXPECT_FALSE(cache.Remove(origin,
|
| + kRealm1,
|
| + HttpAuth::AUTH_SCHEME_DIGEST,
|
| + AuthCredentials(kAlice, k123)));
|
|
|
| // Succeeds.
|
| - EXPECT_TRUE(cache.Remove(
|
| - origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC,
|
| - AuthCredentials(kAlice, k123)));
|
| + EXPECT_TRUE(cache.Remove(origin,
|
| + kRealm1,
|
| + HttpAuth::AUTH_SCHEME_BASIC,
|
| + AuthCredentials(kAlice, k123)));
|
|
|
| // Fails because we just deleted the entry!
|
| - EXPECT_FALSE(cache.Remove(
|
| - origin, kRealm1, HttpAuth::AUTH_SCHEME_BASIC,
|
| - AuthCredentials(kAlice, k123)));
|
| + EXPECT_FALSE(cache.Remove(origin,
|
| + kRealm1,
|
| + HttpAuth::AUTH_SCHEME_BASIC,
|
| + AuthCredentials(kAlice, k123)));
|
|
|
| // Succeed when there are two authentication types for the same origin,realm.
|
| - EXPECT_TRUE(cache.Remove(
|
| - origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST,
|
| - AuthCredentials(kRoot, kWileCoyote)));
|
| + EXPECT_TRUE(cache.Remove(origin,
|
| + kRealm3,
|
| + HttpAuth::AUTH_SCHEME_DIGEST,
|
| + AuthCredentials(kRoot, kWileCoyote)));
|
|
|
| // Succeed as above, but when entries were added in opposite order
|
| - cache.Add(origin, realm3_digest_handler->realm(),
|
| - realm3_digest_handler->auth_scheme(), "digest realm=Realm3",
|
| - AuthCredentials(kRoot, kWileCoyote), "/");
|
| - EXPECT_TRUE(cache.Remove(
|
| - origin, kRealm3, HttpAuth::AUTH_SCHEME_BASIC,
|
| - AuthCredentials(kAdmin, kPassword)));
|
| + cache.Add(origin,
|
| + realm3_digest_handler->realm(),
|
| + realm3_digest_handler->auth_scheme(),
|
| + "digest realm=Realm3",
|
| + AuthCredentials(kRoot, kWileCoyote),
|
| + "/");
|
| + EXPECT_TRUE(cache.Remove(origin,
|
| + kRealm3,
|
| + HttpAuth::AUTH_SCHEME_BASIC,
|
| + AuthCredentials(kAdmin, kPassword)));
|
|
|
| // Make sure that removing one entry still leaves the other available for
|
| // lookup.
|
| - HttpAuthCache::Entry* entry = cache.Lookup(
|
| - origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST);
|
| + HttpAuthCache::Entry* entry =
|
| + cache.Lookup(origin, kRealm3, HttpAuth::AUTH_SCHEME_DIGEST);
|
| EXPECT_FALSE(NULL == entry);
|
| }
|
|
|
| TEST(HttpAuthCacheTest, UpdateStaleChallenge) {
|
| HttpAuthCache cache;
|
| GURL origin("http://foobar2.com");
|
| - scoped_ptr<HttpAuthHandler> digest_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_DIGEST, kRealm1, HttpAuth::AUTH_PROXY));
|
| + scoped_ptr<HttpAuthHandler> digest_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_DIGEST, kRealm1, HttpAuth::AUTH_PROXY));
|
| HttpAuthCache::Entry* entry_pre = cache.Add(
|
| origin,
|
| digest_handler->realm(),
|
| @@ -423,9 +450,7 @@ TEST(HttpAuthCacheTest, UpdateStaleChallenge) {
|
| // After the stale update, the entry should still exist in the cache and
|
| // the nonce count should be reset to 0.
|
| HttpAuthCache::Entry* entry_post = cache.Lookup(
|
| - origin,
|
| - digest_handler->realm(),
|
| - digest_handler->auth_scheme());
|
| + origin, digest_handler->realm(), digest_handler->auth_scheme());
|
| ASSERT_TRUE(entry_post != NULL);
|
| EXPECT_EQ(2, entry_post->IncrementNonceCount());
|
|
|
| @@ -445,50 +470,63 @@ TEST(HttpAuthCacheTest, UpdateAllFrom) {
|
| std::string path("/some/path");
|
| std::string another_path("/another/path");
|
|
|
| - scoped_ptr<HttpAuthHandler> realm1_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm1_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm1, HttpAuth::AUTH_SERVER));
|
|
|
| - scoped_ptr<HttpAuthHandler> realm2_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_PROXY));
|
| + scoped_ptr<HttpAuthHandler> realm2_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm2, HttpAuth::AUTH_PROXY));
|
|
|
| - scoped_ptr<HttpAuthHandler> realm3_digest_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm3_digest_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_DIGEST, kRealm3, HttpAuth::AUTH_SERVER));
|
|
|
| - scoped_ptr<HttpAuthHandler> realm4_handler(
|
| - new MockAuthHandler(
|
| - HttpAuth::AUTH_SCHEME_BASIC, kRealm4, HttpAuth::AUTH_SERVER));
|
| + scoped_ptr<HttpAuthHandler> realm4_handler(new MockAuthHandler(
|
| + HttpAuth::AUTH_SCHEME_BASIC, kRealm4, HttpAuth::AUTH_SERVER));
|
|
|
| HttpAuthCache first_cache;
|
| HttpAuthCache::Entry* entry;
|
|
|
| - first_cache.Add(origin, realm1_handler->realm(),
|
| - realm1_handler->auth_scheme(), "basic realm=Realm1",
|
| - AuthCredentials(kAlice, k123), path);
|
| - first_cache.Add(origin, realm2_handler->realm(),
|
| - realm2_handler->auth_scheme(), "basic realm=Realm2",
|
| - AuthCredentials(kAlice2, k1234), path);
|
| - first_cache.Add(origin, realm3_digest_handler->realm(),
|
| - realm3_digest_handler->auth_scheme(), "digest realm=Realm3",
|
| - AuthCredentials(kRoot, kWileCoyote), path);
|
| - entry = first_cache.Add(
|
| - origin, realm3_digest_handler->realm(),
|
| - realm3_digest_handler->auth_scheme(), "digest realm=Realm3",
|
| - AuthCredentials(kRoot, kWileCoyote), another_path);
|
| + first_cache.Add(origin,
|
| + realm1_handler->realm(),
|
| + realm1_handler->auth_scheme(),
|
| + "basic realm=Realm1",
|
| + AuthCredentials(kAlice, k123),
|
| + path);
|
| + first_cache.Add(origin,
|
| + realm2_handler->realm(),
|
| + realm2_handler->auth_scheme(),
|
| + "basic realm=Realm2",
|
| + AuthCredentials(kAlice2, k1234),
|
| + path);
|
| + first_cache.Add(origin,
|
| + realm3_digest_handler->realm(),
|
| + realm3_digest_handler->auth_scheme(),
|
| + "digest realm=Realm3",
|
| + AuthCredentials(kRoot, kWileCoyote),
|
| + path);
|
| + entry = first_cache.Add(origin,
|
| + realm3_digest_handler->realm(),
|
| + realm3_digest_handler->auth_scheme(),
|
| + "digest realm=Realm3",
|
| + AuthCredentials(kRoot, kWileCoyote),
|
| + another_path);
|
|
|
| EXPECT_EQ(2, entry->IncrementNonceCount());
|
|
|
| HttpAuthCache second_cache;
|
| // Will be overwritten by kRoot:kWileCoyote.
|
| - second_cache.Add(origin, realm3_digest_handler->realm(),
|
| - realm3_digest_handler->auth_scheme(), "digest realm=Realm3",
|
| - AuthCredentials(kAlice2, k1234), path);
|
| + second_cache.Add(origin,
|
| + realm3_digest_handler->realm(),
|
| + realm3_digest_handler->auth_scheme(),
|
| + "digest realm=Realm3",
|
| + AuthCredentials(kAlice2, k1234),
|
| + path);
|
| // Should be left intact.
|
| - second_cache.Add(origin, realm4_handler->realm(),
|
| - realm4_handler->auth_scheme(), "basic realm=Realm4",
|
| - AuthCredentials(kAdmin, kRoot), path);
|
| + second_cache.Add(origin,
|
| + realm4_handler->realm(),
|
| + realm4_handler->auth_scheme(),
|
| + "basic realm=Realm4",
|
| + AuthCredentials(kAdmin, kRoot),
|
| + path);
|
|
|
| second_cache.UpdateAllFrom(first_cache);
|
|
|
| @@ -529,7 +567,7 @@ TEST(HttpAuthCacheTest, UpdateAllFrom) {
|
| // insertion and existence testing).
|
| class HttpAuthCacheEvictionTest : public testing::Test {
|
| protected:
|
| - HttpAuthCacheEvictionTest() : origin_("http://www.google.com") { }
|
| + HttpAuthCacheEvictionTest() : origin_("http://www.google.com") {}
|
|
|
| std::string GenerateRealm(int realm_i) {
|
| return base::StringPrintf("Realm %d", realm_i);
|
| @@ -539,9 +577,7 @@ class HttpAuthCacheEvictionTest : public testing::Test {
|
| return base::StringPrintf("/%d/%d/x/y", realm_i, path_i);
|
| }
|
|
|
| - void AddRealm(int realm_i) {
|
| - AddPathToRealm(realm_i, 0);
|
| - }
|
| + void AddRealm(int realm_i) { AddPathToRealm(realm_i, 0); }
|
|
|
| void AddPathToRealm(int realm_i, int path_i) {
|
| cache_.Add(origin_,
|
| @@ -553,9 +589,8 @@ class HttpAuthCacheEvictionTest : public testing::Test {
|
| }
|
|
|
| void CheckRealmExistence(int realm_i, bool exists) {
|
| - const HttpAuthCache::Entry* entry =
|
| - cache_.Lookup(
|
| - origin_, GenerateRealm(realm_i), HttpAuth::AUTH_SCHEME_BASIC);
|
| + const HttpAuthCache::Entry* entry = cache_.Lookup(
|
| + origin_, GenerateRealm(realm_i), HttpAuth::AUTH_SCHEME_BASIC);
|
| if (exists) {
|
| EXPECT_FALSE(entry == NULL);
|
| EXPECT_EQ(GenerateRealm(realm_i), entry->realm());
|
|
|