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

Unified Diff: net/http/http_mac_signature_unittest.cc

Issue 9700056: Remove experimental support for MAC cookies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused global Created 8 years, 9 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/http/http_mac_signature.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_mac_signature_unittest.cc
diff --git a/net/http/http_mac_signature_unittest.cc b/net/http/http_mac_signature_unittest.cc
deleted file mode 100644
index 130ce39b59ac1dc64c2b5ccc4e57f10b829b3d37..0000000000000000000000000000000000000000
--- a/net/http/http_mac_signature_unittest.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "net/http/http_mac_signature.h"
-
-namespace net {
-
-TEST(HttpMacSignatureTest, BogusAddStateInfo) {
- HttpMacSignature signature;
- EXPECT_FALSE(signature.AddStateInfo("exciting-id",
- base::Time::Now(),
- "the-mac-key",
- "bogus-hmac-algorithm"));
- EXPECT_FALSE(signature.AddStateInfo("",
- base::Time::Now(),
- "the-mac-key",
- "hmac-sha-1"));
- EXPECT_FALSE(signature.AddStateInfo("exciting-id",
- base::Time(),
- "the-mac-key",
- "hmac-sha-1"));
- EXPECT_FALSE(signature.AddStateInfo("exciting-id",
- base::Time::Now(),
- "",
- "hmac-sha-1"));
- EXPECT_FALSE(signature.AddStateInfo("exciting-id",
- base::Time::Now(),
- "the-mac-key",
- ""));
-}
-
-TEST(HttpMacSignatureTest, BogusAddHttpInfo) {
- HttpMacSignature signature;
- EXPECT_FALSE(signature.AddHttpInfo("GET", "/requested", "example.com", 0));
- EXPECT_FALSE(signature.AddHttpInfo(
- "GET", "/requested", "example.com", 29088983));
- EXPECT_FALSE(signature.AddHttpInfo("", "/requested", "example.com", 80));
- EXPECT_FALSE(signature.AddHttpInfo("GET", "", "example.com", 80));
- EXPECT_FALSE(signature.AddHttpInfo("GET", "/requested", "", 80));
-}
-
-TEST(HttpMacSignatureTest, GenerateHeaderString) {
- HttpMacSignature signature;
- EXPECT_TRUE(signature.AddStateInfo("dfoi30j0qnf",
- base::Time::Now(),
- "adiMf03j0f3nOenc003r",
- "hmac-sha-1"));
- EXPECT_TRUE(signature.AddHttpInfo("GeT",
- "/pAth?to=%22enlightenment%22&dest=magic",
- "eXaMple.com",
- 80));
-
- std::string age = "239034";
- std::string nonce = "mn4302j0n+32r2/f3r=";
-
- std::string header_string;
- EXPECT_TRUE(signature.GenerateHeaderString(age, nonce, &header_string));
- EXPECT_EQ("MAC id=\"dfoi30j0qnf\", "
- "nonce=\"239034:mn4302j0n+32r2/f3r=\", "
- "mac=\"GrkHtPKzB1m1dCHfa7OCWOw6Ecw=\"",
- header_string);
-}
-
-
-TEST(HttpMacSignatureTest, GenerateNormalizedRequest) {
- HttpMacSignature signature;
- EXPECT_TRUE(signature.AddStateInfo("dfoi30j0qnf",
- base::Time::Now(),
- "adiMf03j0f3nOenc003r",
- "hmac-sha-1"));
- EXPECT_TRUE(signature.AddHttpInfo("GeT",
- "/pAth?to=%22enlightenment%22&dest=magic",
- "eXaMple.com",
- 80));
-
- std::string age = "239034";
- std::string nonce = "mn4302j0n+32r2/f3r=";
-
- EXPECT_EQ("239034:mn4302j0n+32r2/f3r=\n"
- "GET\n"
- "/pAth?to=%22enlightenment%22&dest=magic\n"
- "example.com\n"
- "80\n"
- "\n"
- "\n",
- signature.GenerateNormalizedRequest(age, nonce));
-}
-
-TEST(HttpMacSignatureTest, GenerateMAC) {
- HttpMacSignature signature;
- EXPECT_TRUE(signature.AddStateInfo("dfoi30j0qnf",
- base::Time::Now(),
- "adiMf03j0f3nOenc003r",
- "hmac-sha-1"));
- EXPECT_TRUE(signature.AddHttpInfo("GeT",
- "/pAth?to=%22enlightenment%22&dest=magic",
- "eXaMple.com",
- 80));
-
- std::string age = "239034";
- std::string nonce = "mn4302j0n+32r2/f3r=";
-
- std::string mac;
- EXPECT_TRUE(signature.GenerateMAC(age, nonce, &mac));
- EXPECT_EQ("GrkHtPKzB1m1dCHfa7OCWOw6Ecw=", mac);
-}
-}
« no previous file with comments | « net/http/http_mac_signature.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698