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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 1084533002: Rename NetLogLogger and CapturingNetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename NetLogLogger and CapturingNetLog(removed compiler error for chromeOS) Created 5 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 27 matching lines...) Expand all
38 #include "extensions/common/api/web_request.h" 38 #include "extensions/common/api/web_request.h"
39 #include "extensions/common/extension_messages.h" 39 #include "extensions/common/extension_messages.h"
40 #include "extensions/common/features/feature.h" 40 #include "extensions/common/features/feature.h"
41 #include "net/base/auth.h" 41 #include "net/base/auth.h"
42 #include "net/base/elements_upload_data_stream.h" 42 #include "net/base/elements_upload_data_stream.h"
43 #include "net/base/net_util.h" 43 #include "net/base/net_util.h"
44 #include "net/base/request_priority.h" 44 #include "net/base/request_priority.h"
45 #include "net/base/upload_bytes_element_reader.h" 45 #include "net/base/upload_bytes_element_reader.h"
46 #include "net/base/upload_file_element_reader.h" 46 #include "net/base/upload_file_element_reader.h"
47 #include "net/dns/mock_host_resolver.h" 47 #include "net/dns/mock_host_resolver.h"
48 #include "net/log/capturing_net_log.h" 48 #include "net/log/test_net_log.h"
49 #include "net/url_request/url_request_job_factory_impl.h" 49 #include "net/url_request/url_request_job_factory_impl.h"
50 #include "net/url_request/url_request_test_util.h" 50 #include "net/url_request/url_request_test_util.h"
51 #include "testing/gtest/include/gtest/gtest-message.h" 51 #include "testing/gtest/include/gtest/gtest-message.h"
52 #include "testing/gtest/include/gtest/gtest.h" 52 #include "testing/gtest/include/gtest/gtest.h"
53 53
54 namespace helpers = extension_web_request_api_helpers; 54 namespace helpers = extension_web_request_api_helpers;
55 namespace keys = extension_web_request_api_constants; 55 namespace keys = extension_web_request_api_constants;
56 namespace web_request = extensions::core_api::web_request; 56 namespace web_request = extensions::core_api::web_request;
57 57
58 using base::BinaryValue; 58 using base::BinaryValue;
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 &credentials)); 1314 &credentials));
1315 ASSERT_TRUE(delta.get()); 1315 ASSERT_TRUE(delta.get());
1316 EXPECT_TRUE(delta->cancel); 1316 EXPECT_TRUE(delta->cancel);
1317 ASSERT_TRUE(delta->auth_credentials.get()); 1317 ASSERT_TRUE(delta->auth_credentials.get());
1318 EXPECT_EQ(username, delta->auth_credentials->username()); 1318 EXPECT_EQ(username, delta->auth_credentials->username());
1319 EXPECT_EQ(password, delta->auth_credentials->password()); 1319 EXPECT_EQ(password, delta->auth_credentials->password());
1320 } 1320 }
1321 1321
1322 TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) { 1322 TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) {
1323 EventResponseDeltas deltas; 1323 EventResponseDeltas deltas;
1324 net::CapturingBoundNetLog capturing_net_log; 1324 net::BoundTestNetLog capturing_net_log;
1325 net::BoundNetLog net_log = capturing_net_log.bound(); 1325 net::BoundNetLog net_log = capturing_net_log.bound();
1326 bool canceled = false; 1326 bool canceled = false;
1327 1327
1328 // Single event that does not cancel. 1328 // Single event that does not cancel.
1329 linked_ptr<EventResponseDelta> d1( 1329 linked_ptr<EventResponseDelta> d1(
1330 new EventResponseDelta("extid1", base::Time::FromInternalValue(1000))); 1330 new EventResponseDelta("extid1", base::Time::FromInternalValue(1000)));
1331 d1->cancel = false; 1331 d1->cancel = false;
1332 deltas.push_back(d1); 1332 deltas.push_back(d1);
1333 MergeCancelOfResponses(deltas, &canceled, &net_log); 1333 MergeCancelOfResponses(deltas, &canceled, &net_log);
1334 EXPECT_FALSE(canceled); 1334 EXPECT_FALSE(canceled);
1335 EXPECT_EQ(0u, capturing_net_log.GetSize()); 1335 EXPECT_EQ(0u, capturing_net_log.GetSize());
1336 1336
1337 // Second event that cancels the request 1337 // Second event that cancels the request
1338 linked_ptr<EventResponseDelta> d2( 1338 linked_ptr<EventResponseDelta> d2(
1339 new EventResponseDelta("extid2", base::Time::FromInternalValue(500))); 1339 new EventResponseDelta("extid2", base::Time::FromInternalValue(500)));
1340 d2->cancel = true; 1340 d2->cancel = true;
1341 deltas.push_back(d2); 1341 deltas.push_back(d2);
1342 deltas.sort(&InDecreasingExtensionInstallationTimeOrder); 1342 deltas.sort(&InDecreasingExtensionInstallationTimeOrder);
1343 MergeCancelOfResponses(deltas, &canceled, &net_log); 1343 MergeCancelOfResponses(deltas, &canceled, &net_log);
1344 EXPECT_TRUE(canceled); 1344 EXPECT_TRUE(canceled);
1345 EXPECT_EQ(1u, capturing_net_log.GetSize()); 1345 EXPECT_EQ(1u, capturing_net_log.GetSize());
1346 } 1346 }
1347 1347
1348 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses) { 1348 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses) {
1349 EventResponseDeltas deltas; 1349 EventResponseDeltas deltas;
1350 net::CapturingBoundNetLog capturing_net_log; 1350 net::BoundTestNetLog capturing_net_log;
1351 net::BoundNetLog net_log = capturing_net_log.bound(); 1351 net::BoundNetLog net_log = capturing_net_log.bound();
1352 WarningSet warning_set; 1352 WarningSet warning_set;
1353 GURL effective_new_url; 1353 GURL effective_new_url;
1354 1354
1355 // No redirect 1355 // No redirect
1356 linked_ptr<EventResponseDelta> d0( 1356 linked_ptr<EventResponseDelta> d0(
1357 new EventResponseDelta("extid0", base::Time::FromInternalValue(0))); 1357 new EventResponseDelta("extid0", base::Time::FromInternalValue(0)));
1358 deltas.push_back(d0); 1358 deltas.push_back(d0);
1359 MergeOnBeforeRequestResponses( 1359 MergeOnBeforeRequestResponses(
1360 deltas, &effective_new_url, &warning_set, &net_log); 1360 deltas, &effective_new_url, &warning_set, &net_log);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 EXPECT_EQ(2u, warning_set.size()); 1421 EXPECT_EQ(2u, warning_set.size());
1422 EXPECT_TRUE(HasWarning(warning_set, "extid1")); 1422 EXPECT_TRUE(HasWarning(warning_set, "extid1"));
1423 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 1423 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
1424 EXPECT_EQ(4u, capturing_net_log.GetSize()); 1424 EXPECT_EQ(4u, capturing_net_log.GetSize());
1425 } 1425 }
1426 1426
1427 // This tests that we can redirect to data:// urls, which is considered 1427 // This tests that we can redirect to data:// urls, which is considered
1428 // a kind of cancelling requests. 1428 // a kind of cancelling requests.
1429 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) { 1429 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) {
1430 EventResponseDeltas deltas; 1430 EventResponseDeltas deltas;
1431 net::CapturingBoundNetLog capturing_net_log; 1431 net::BoundTestNetLog capturing_net_log;
1432 net::BoundNetLog net_log = capturing_net_log.bound(); 1432 net::BoundNetLog net_log = capturing_net_log.bound();
1433 WarningSet warning_set; 1433 WarningSet warning_set;
1434 GURL effective_new_url; 1434 GURL effective_new_url;
1435 1435
1436 // Single redirect. 1436 // Single redirect.
1437 GURL new_url_0("http://foo.com"); 1437 GURL new_url_0("http://foo.com");
1438 linked_ptr<EventResponseDelta> d0( 1438 linked_ptr<EventResponseDelta> d0(
1439 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000))); 1439 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000)));
1440 d0->new_url = GURL(new_url_0); 1440 d0->new_url = GURL(new_url_0);
1441 deltas.push_back(d0); 1441 deltas.push_back(d0);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 EXPECT_EQ(new_url_1, effective_new_url); 1490 EXPECT_EQ(new_url_1, effective_new_url);
1491 EXPECT_EQ(1u, warning_set.size()); 1491 EXPECT_EQ(1u, warning_set.size());
1492 EXPECT_TRUE(HasWarning(warning_set, "extid3")); 1492 EXPECT_TRUE(HasWarning(warning_set, "extid3"));
1493 EXPECT_EQ(3u, capturing_net_log.GetSize()); 1493 EXPECT_EQ(3u, capturing_net_log.GetSize());
1494 } 1494 }
1495 1495
1496 // This tests that we can redirect to about:blank, which is considered 1496 // This tests that we can redirect to about:blank, which is considered
1497 // a kind of cancelling requests. 1497 // a kind of cancelling requests.
1498 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses3) { 1498 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses3) {
1499 EventResponseDeltas deltas; 1499 EventResponseDeltas deltas;
1500 net::CapturingBoundNetLog capturing_net_log; 1500 net::BoundTestNetLog capturing_net_log;
1501 net::BoundNetLog net_log = capturing_net_log.bound(); 1501 net::BoundNetLog net_log = capturing_net_log.bound();
1502 WarningSet warning_set; 1502 WarningSet warning_set;
1503 GURL effective_new_url; 1503 GURL effective_new_url;
1504 1504
1505 // Single redirect. 1505 // Single redirect.
1506 GURL new_url_0("http://foo.com"); 1506 GURL new_url_0("http://foo.com");
1507 linked_ptr<EventResponseDelta> d0( 1507 linked_ptr<EventResponseDelta> d0(
1508 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000))); 1508 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000)));
1509 d0->new_url = GURL(new_url_0); 1509 d0->new_url = GURL(new_url_0);
1510 deltas.push_back(d0); 1510 deltas.push_back(d0);
(...skipping 15 matching lines...) Expand all
1526 deltas, &effective_new_url, &warning_set, &net_log); 1526 deltas, &effective_new_url, &warning_set, &net_log);
1527 EXPECT_EQ(new_url_1, effective_new_url); 1527 EXPECT_EQ(new_url_1, effective_new_url);
1528 EXPECT_TRUE(warning_set.empty()); 1528 EXPECT_TRUE(warning_set.empty());
1529 EXPECT_EQ(1u, capturing_net_log.GetSize()); 1529 EXPECT_EQ(1u, capturing_net_log.GetSize());
1530 } 1530 }
1531 1531
1532 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) { 1532 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) {
1533 net::HttpRequestHeaders base_headers; 1533 net::HttpRequestHeaders base_headers;
1534 base_headers.AddHeaderFromString("key1: value 1"); 1534 base_headers.AddHeaderFromString("key1: value 1");
1535 base_headers.AddHeaderFromString("key2: value 2"); 1535 base_headers.AddHeaderFromString("key2: value 2");
1536 net::CapturingBoundNetLog capturing_net_log; 1536 net::BoundTestNetLog capturing_net_log;
1537 net::BoundNetLog net_log = capturing_net_log.bound(); 1537 net::BoundNetLog net_log = capturing_net_log.bound();
1538 WarningSet warning_set; 1538 WarningSet warning_set;
1539 std::string header_value; 1539 std::string header_value;
1540 EventResponseDeltas deltas; 1540 EventResponseDeltas deltas;
1541 1541
1542 // Check that we can handle not changing the headers. 1542 // Check that we can handle not changing the headers.
1543 linked_ptr<EventResponseDelta> d0( 1543 linked_ptr<EventResponseDelta> d0(
1544 new EventResponseDelta("extid0", base::Time::FromInternalValue(2500))); 1544 new EventResponseDelta("extid0", base::Time::FromInternalValue(2500)));
1545 deltas.push_back(d0); 1545 deltas.push_back(d0);
1546 net::HttpRequestHeaders headers0; 1546 net::HttpRequestHeaders headers0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 EXPECT_EQ(1u, warning_set.size()); 1622 EXPECT_EQ(1u, warning_set.size());
1623 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 1623 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
1624 EXPECT_EQ(3u, capturing_net_log.GetSize()); 1624 EXPECT_EQ(3u, capturing_net_log.GetSize());
1625 } 1625 }
1626 1626
1627 TEST(ExtensionWebRequestHelpersTest, 1627 TEST(ExtensionWebRequestHelpersTest,
1628 TestMergeOnBeforeSendHeadersResponses_Cookies) { 1628 TestMergeOnBeforeSendHeadersResponses_Cookies) {
1629 net::HttpRequestHeaders base_headers; 1629 net::HttpRequestHeaders base_headers;
1630 base_headers.AddHeaderFromString( 1630 base_headers.AddHeaderFromString(
1631 "Cookie: name=value; name2=value2; name3=\"value3\""); 1631 "Cookie: name=value; name2=value2; name3=\"value3\"");
1632 net::CapturingBoundNetLog capturing_net_log; 1632 net::BoundTestNetLog capturing_net_log;
1633 net::BoundNetLog net_log = capturing_net_log.bound(); 1633 net::BoundNetLog net_log = capturing_net_log.bound();
1634 WarningSet warning_set; 1634 WarningSet warning_set;
1635 std::string header_value; 1635 std::string header_value;
1636 EventResponseDeltas deltas; 1636 EventResponseDeltas deltas;
1637 1637
1638 linked_ptr<RequestCookieModification> add_cookie = 1638 linked_ptr<RequestCookieModification> add_cookie =
1639 make_linked_ptr(new RequestCookieModification); 1639 make_linked_ptr(new RequestCookieModification);
1640 add_cookie->type = helpers::ADD; 1640 add_cookie->type = helpers::ADD;
1641 add_cookie->modification.reset(new helpers::RequestCookie); 1641 add_cookie->modification.reset(new helpers::RequestCookie);
1642 add_cookie->modification->name.reset(new std::string("name4")); 1642 add_cookie->modification->name.reset(new std::string("name4"));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 exploded_time.year, 1706 exploded_time.year,
1707 exploded_time.hour, 1707 exploded_time.hour,
1708 exploded_time.minute, 1708 exploded_time.minute,
1709 exploded_time.second); 1709 exploded_time.second);
1710 } 1710 }
1711 1711
1712 } // namespace 1712 } // namespace
1713 1713
1714 TEST(ExtensionWebRequestHelpersTest, 1714 TEST(ExtensionWebRequestHelpersTest,
1715 TestMergeCookiesInOnHeadersReceivedResponses) { 1715 TestMergeCookiesInOnHeadersReceivedResponses) {
1716 net::CapturingBoundNetLog capturing_net_log; 1716 net::BoundTestNetLog capturing_net_log;
1717 net::BoundNetLog net_log = capturing_net_log.bound(); 1717 net::BoundNetLog net_log = capturing_net_log.bound();
1718 WarningSet warning_set; 1718 WarningSet warning_set;
1719 std::string header_value; 1719 std::string header_value;
1720 EventResponseDeltas deltas; 1720 EventResponseDeltas deltas;
1721 1721
1722 std::string cookie_expiration = GetCookieExpirationDate(1200); 1722 std::string cookie_expiration = GetCookieExpirationDate(1200);
1723 std::string base_headers_string = 1723 std::string base_headers_string =
1724 "HTTP/1.0 200 OK\r\n" 1724 "HTTP/1.0 200 OK\r\n"
1725 "Foo: Bar\r\n" 1725 "Foo: Bar\r\n"
1726 "Set-Cookie: name=value; DOMAIN=google.com; Secure\r\n" 1726 "Set-Cookie: name=value; DOMAIN=google.com; Secure\r\n"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 "uBound5=value12; max-age=600; expires=" + cookie_expiration+ "; secure"); 1941 "uBound5=value12; max-age=600; expires=" + cookie_expiration+ "; secure");
1942 std::set<std::string> actual_cookies; 1942 std::set<std::string> actual_cookies;
1943 while (new_headers1->EnumerateHeader(&iter, "Set-Cookie", &cookie_string)) 1943 while (new_headers1->EnumerateHeader(&iter, "Set-Cookie", &cookie_string))
1944 actual_cookies.insert(cookie_string); 1944 actual_cookies.insert(cookie_string);
1945 EXPECT_EQ(expected_cookies, actual_cookies); 1945 EXPECT_EQ(expected_cookies, actual_cookies);
1946 EXPECT_EQ(0u, warning_set.size()); 1946 EXPECT_EQ(0u, warning_set.size());
1947 EXPECT_EQ(0u, capturing_net_log.GetSize()); 1947 EXPECT_EQ(0u, capturing_net_log.GetSize());
1948 } 1948 }
1949 1949
1950 TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) { 1950 TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) {
1951 net::CapturingBoundNetLog capturing_net_log; 1951 net::BoundTestNetLog capturing_net_log;
1952 net::BoundNetLog net_log = capturing_net_log.bound(); 1952 net::BoundNetLog net_log = capturing_net_log.bound();
1953 WarningSet warning_set; 1953 WarningSet warning_set;
1954 std::string header_value; 1954 std::string header_value;
1955 EventResponseDeltas deltas; 1955 EventResponseDeltas deltas;
1956 1956
1957 char base_headers_string[] = 1957 char base_headers_string[] =
1958 "HTTP/1.0 200 OK\r\n" 1958 "HTTP/1.0 200 OK\r\n"
1959 "Key1: Value1\r\n" 1959 "Key1: Value1\r\n"
1960 "Key2: Value2, Foo\r\n" 1960 "Key2: Value2, Foo\r\n"
1961 "\r\n"; 1961 "\r\n";
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 } 2041 }
2042 EXPECT_EQ(expected1, actual2); 2042 EXPECT_EQ(expected1, actual2);
2043 EXPECT_EQ(1u, warning_set.size()); 2043 EXPECT_EQ(1u, warning_set.size());
2044 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2044 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2045 EXPECT_EQ(2u, capturing_net_log.GetSize()); 2045 EXPECT_EQ(2u, capturing_net_log.GetSize());
2046 } 2046 }
2047 2047
2048 // Check that we do not delete too much 2048 // Check that we do not delete too much
2049 TEST(ExtensionWebRequestHelpersTest, 2049 TEST(ExtensionWebRequestHelpersTest,
2050 TestMergeOnHeadersReceivedResponsesDeletion) { 2050 TestMergeOnHeadersReceivedResponsesDeletion) {
2051 net::CapturingBoundNetLog capturing_net_log; 2051 net::BoundTestNetLog capturing_net_log;
2052 net::BoundNetLog net_log = capturing_net_log.bound(); 2052 net::BoundNetLog net_log = capturing_net_log.bound();
2053 WarningSet warning_set; 2053 WarningSet warning_set;
2054 std::string header_value; 2054 std::string header_value;
2055 EventResponseDeltas deltas; 2055 EventResponseDeltas deltas;
2056 2056
2057 char base_headers_string[] = 2057 char base_headers_string[] =
2058 "HTTP/1.0 200 OK\r\n" 2058 "HTTP/1.0 200 OK\r\n"
2059 "Key1: Value1\r\n" 2059 "Key1: Value1\r\n"
2060 "Key1: Value2\r\n" 2060 "Key1: Value2\r\n"
2061 "Key1: Value3\r\n" 2061 "Key1: Value3\r\n"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 EXPECT_EQ(0u, warning_set.size()); 2095 EXPECT_EQ(0u, warning_set.size());
2096 EXPECT_EQ(1u, capturing_net_log.GetSize()); 2096 EXPECT_EQ(1u, capturing_net_log.GetSize());
2097 } 2097 }
2098 2098
2099 // Tests whether onHeadersReceived can initiate a redirect. 2099 // Tests whether onHeadersReceived can initiate a redirect.
2100 // The URL merge logic is shared with onBeforeRequest, so we only need to test 2100 // The URL merge logic is shared with onBeforeRequest, so we only need to test
2101 // whether the URLs are merged at all. 2101 // whether the URLs are merged at all.
2102 TEST(ExtensionWebRequestHelpersTest, 2102 TEST(ExtensionWebRequestHelpersTest,
2103 TestMergeOnHeadersReceivedResponsesRedirect) { 2103 TestMergeOnHeadersReceivedResponsesRedirect) {
2104 EventResponseDeltas deltas; 2104 EventResponseDeltas deltas;
2105 net::CapturingBoundNetLog capturing_net_log; 2105 net::BoundTestNetLog capturing_net_log;
2106 net::BoundNetLog net_log = capturing_net_log.bound(); 2106 net::BoundNetLog net_log = capturing_net_log.bound();
2107 WarningSet warning_set; 2107 WarningSet warning_set;
2108 2108
2109 char base_headers_string[] = 2109 char base_headers_string[] =
2110 "HTTP/1.0 200 OK\r\n" 2110 "HTTP/1.0 200 OK\r\n"
2111 "\r\n"; 2111 "\r\n";
2112 scoped_refptr<net::HttpResponseHeaders> base_headers( 2112 scoped_refptr<net::HttpResponseHeaders> base_headers(
2113 new net::HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders( 2113 new net::HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders(
2114 base_headers_string, sizeof(base_headers_string)))); 2114 base_headers_string, sizeof(base_headers_string))));
2115 2115
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 &net_log); 2148 &net_log);
2149 2149
2150 EXPECT_TRUE(new_headers1.get()); 2150 EXPECT_TRUE(new_headers1.get());
2151 EXPECT_TRUE(new_headers1->HasHeaderValue("Location", new_url_1.spec())); 2151 EXPECT_TRUE(new_headers1->HasHeaderValue("Location", new_url_1.spec()));
2152 EXPECT_EQ(new_url_1, allowed_unsafe_redirect_url1); 2152 EXPECT_EQ(new_url_1, allowed_unsafe_redirect_url1);
2153 EXPECT_TRUE(warning_set.empty()); 2153 EXPECT_TRUE(warning_set.empty());
2154 EXPECT_EQ(1u, capturing_net_log.GetSize()); 2154 EXPECT_EQ(1u, capturing_net_log.GetSize());
2155 } 2155 }
2156 2156
2157 TEST(ExtensionWebRequestHelpersTest, TestMergeOnAuthRequiredResponses) { 2157 TEST(ExtensionWebRequestHelpersTest, TestMergeOnAuthRequiredResponses) {
2158 net::CapturingBoundNetLog capturing_net_log; 2158 net::BoundTestNetLog capturing_net_log;
2159 net::BoundNetLog net_log = capturing_net_log.bound(); 2159 net::BoundNetLog net_log = capturing_net_log.bound();
2160 WarningSet warning_set; 2160 WarningSet warning_set;
2161 EventResponseDeltas deltas; 2161 EventResponseDeltas deltas;
2162 base::string16 username = base::ASCIIToUTF16("foo"); 2162 base::string16 username = base::ASCIIToUTF16("foo");
2163 base::string16 password = base::ASCIIToUTF16("bar"); 2163 base::string16 password = base::ASCIIToUTF16("bar");
2164 base::string16 password2 = base::ASCIIToUTF16("baz"); 2164 base::string16 password2 = base::ASCIIToUTF16("baz");
2165 2165
2166 // Check that we can handle if not returning credentials. 2166 // Check that we can handle if not returning credentials.
2167 linked_ptr<EventResponseDelta> d0( 2167 linked_ptr<EventResponseDelta> d0(
2168 new EventResponseDelta("extid0", base::Time::FromInternalValue(3000))); 2168 new EventResponseDelta("extid0", base::Time::FromInternalValue(3000)));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 EXPECT_TRUE(credentials_set); 2227 EXPECT_TRUE(credentials_set);
2228 EXPECT_FALSE(auth3.Empty()); 2228 EXPECT_FALSE(auth3.Empty());
2229 EXPECT_EQ(username, auth1.username()); 2229 EXPECT_EQ(username, auth1.username());
2230 EXPECT_EQ(password, auth1.password()); 2230 EXPECT_EQ(password, auth1.password());
2231 EXPECT_EQ(1u, warning_set.size()); 2231 EXPECT_EQ(1u, warning_set.size());
2232 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2232 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2233 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2233 EXPECT_EQ(3u, capturing_net_log.GetSize());
2234 } 2234 }
2235 2235
2236 } // namespace extensions 2236 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/log_private/log_private_api_chromeos.cc ('k') | chrome/browser/net/chrome_net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698