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

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

Issue 2268002: Implemented mid-level Negotiate protocol for Posix. (Closed)
Patch Set: Merged with trunk. Created 10 years, 6 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_unittest.cc ('k') | net/net.gyp » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 request.load_flags = 0; 1801 request.load_flags = 0;
1802 1802
1803 MockWrite data_writes1[] = { 1803 MockWrite data_writes1[] = {
1804 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" 1804 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n"
1805 "Host: 172.22.68.17\r\n" 1805 "Host: 172.22.68.17\r\n"
1806 "Connection: keep-alive\r\n\r\n"), 1806 "Connection: keep-alive\r\n\r\n"),
1807 }; 1807 };
1808 1808
1809 MockRead data_reads1[] = { 1809 MockRead data_reads1[] = {
1810 MockRead("HTTP/1.1 401 Access Denied\r\n"), 1810 MockRead("HTTP/1.1 401 Access Denied\r\n"),
1811 // Negotiate and NTLM are often requested together. We only support NTLM. 1811 // Negotiate and NTLM are often requested together. However, we only want t o test
1812 MockRead("WWW-Authenticate: Negotiate\r\n"), 1812 // NTLM while Negotiate is preferred over NTLM, so we skip that header.
1813 // MockRead("WWW-Authenticate: Negotiate\r\n"),
1813 MockRead("WWW-Authenticate: NTLM\r\n"), 1814 MockRead("WWW-Authenticate: NTLM\r\n"),
1814 MockRead("Connection: close\r\n"), 1815 MockRead("Connection: close\r\n"),
1815 MockRead("Content-Length: 42\r\n"), 1816 MockRead("Content-Length: 42\r\n"),
1816 MockRead("Content-Type: text/html\r\n\r\n"), 1817 MockRead("Content-Type: text/html\r\n\r\n"),
1817 // Missing content -- won't matter, as connection will be reset. 1818 // Missing content -- won't matter, as connection will be reset.
1818 MockRead(false, ERR_UNEXPECTED), 1819 MockRead(false, ERR_UNEXPECTED),
1819 }; 1820 };
1820 1821
1821 MockWrite data_writes2[] = { 1822 MockWrite data_writes2[] = {
1822 // After restarting with a null identity, this is the 1823 // After restarting with a null identity, this is the
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 request.load_flags = 0; 1925 request.load_flags = 0;
1925 1926
1926 MockWrite data_writes1[] = { 1927 MockWrite data_writes1[] = {
1927 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" 1928 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n"
1928 "Host: 172.22.68.17\r\n" 1929 "Host: 172.22.68.17\r\n"
1929 "Connection: keep-alive\r\n\r\n"), 1930 "Connection: keep-alive\r\n\r\n"),
1930 }; 1931 };
1931 1932
1932 MockRead data_reads1[] = { 1933 MockRead data_reads1[] = {
1933 MockRead("HTTP/1.1 401 Access Denied\r\n"), 1934 MockRead("HTTP/1.1 401 Access Denied\r\n"),
1934 // Negotiate and NTLM are often requested together. We only support NTLM. 1935 // Negotiate and NTLM are often requested together. However, we only want t o test
1935 MockRead("WWW-Authenticate: Negotiate\r\n"), 1936 // NTLM while Negotiate is preferred over NTLM, so we skip that header.
1937 // MockRead("WWW-Authenticate: Negotiate\r\n"),
1936 MockRead("WWW-Authenticate: NTLM\r\n"), 1938 MockRead("WWW-Authenticate: NTLM\r\n"),
1937 MockRead("Connection: close\r\n"), 1939 MockRead("Connection: close\r\n"),
1938 MockRead("Content-Length: 42\r\n"), 1940 MockRead("Content-Length: 42\r\n"),
1939 MockRead("Content-Type: text/html\r\n\r\n"), 1941 MockRead("Content-Type: text/html\r\n\r\n"),
1940 // Missing content -- won't matter, as connection will be reset. 1942 // Missing content -- won't matter, as connection will be reset.
1941 MockRead(false, ERR_UNEXPECTED), 1943 MockRead(false, ERR_UNEXPECTED),
1942 }; 1944 };
1943 1945
1944 MockWrite data_writes2[] = { 1946 MockWrite data_writes2[] = {
1945 // After restarting with a null identity, this is the 1947 // After restarting with a null identity, this is the
(...skipping 28 matching lines...) Expand all
1974 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy" 1976 "HAALgBnAG8AbwBnAGwAZQAuAGMAbwBtAAMAQABhAGsAZQBlAHMAYQBy"
1975 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB" 1977 "AGEALQBjAG8AcgBwAC4AYQBkAC4AYwBvAHIAcAAuAGcAbwBvAGcAbAB"
1976 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw" 1978 "lAC4AYwBvAG0ABQAeAGMAbwByAHAALgBnAG8AbwBnAGwAZQAuAGMAbw"
1977 "BtAAAAAAA=\r\n"), 1979 "BtAAAAAAA=\r\n"),
1978 MockRead("Content-Length: 42\r\n"), 1980 MockRead("Content-Length: 42\r\n"),
1979 MockRead("Content-Type: text/html\r\n\r\n"), 1981 MockRead("Content-Type: text/html\r\n\r\n"),
1980 MockRead("You are not authorized to view this page\r\n"), 1982 MockRead("You are not authorized to view this page\r\n"),
1981 1983
1982 // Wrong password. 1984 // Wrong password.
1983 MockRead("HTTP/1.1 401 Access Denied\r\n"), 1985 MockRead("HTTP/1.1 401 Access Denied\r\n"),
1984 MockRead("WWW-Authenticate: Negotiate\r\n"), 1986 // MockRead("WWW-Authenticate: Negotiate\r\n"),
1985 MockRead("WWW-Authenticate: NTLM\r\n"), 1987 MockRead("WWW-Authenticate: NTLM\r\n"),
1986 MockRead("Connection: close\r\n"), 1988 MockRead("Connection: close\r\n"),
1987 MockRead("Content-Length: 42\r\n"), 1989 MockRead("Content-Length: 42\r\n"),
1988 MockRead("Content-Type: text/html\r\n\r\n"), 1990 MockRead("Content-Type: text/html\r\n\r\n"),
1989 // Missing content -- won't matter, as connection will be reset. 1991 // Missing content -- won't matter, as connection will be reset.
1990 MockRead(false, ERR_UNEXPECTED), 1992 MockRead(false, ERR_UNEXPECTED),
1991 }; 1993 };
1992 1994
1993 MockWrite data_writes3[] = { 1995 MockWrite data_writes3[] = {
1994 // After restarting with a null identity, this is the 1996 // After restarting with a null identity, this is the
(...skipping 3753 matching lines...) Expand 10 before | Expand all | Expand 10 after
5748 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); 5750 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data));
5749 EXPECT_EQ("hello world", response_data); 5751 EXPECT_EQ("hello world", response_data);
5750 5752
5751 EXPECT_FALSE(response->was_fetched_via_spdy); 5753 EXPECT_FALSE(response->was_fetched_via_spdy);
5752 EXPECT_TRUE(response->was_npn_negotiated); 5754 EXPECT_TRUE(response->was_npn_negotiated);
5753 5755
5754 HttpNetworkTransaction::SetNextProtos(""); 5756 HttpNetworkTransaction::SetNextProtos("");
5755 HttpNetworkTransaction::SetUseAlternateProtocols(false); 5757 HttpNetworkTransaction::SetUseAlternateProtocols(false);
5756 } 5758 }
5757 } // namespace net 5759 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_unittest.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698