OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <queue> | 10 #include <queue> |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 ASSERT_TRUE(delta.get()); | 1540 ASSERT_TRUE(delta.get()); |
1541 EXPECT_TRUE(delta->cancel); | 1541 EXPECT_TRUE(delta->cancel); |
1542 ASSERT_TRUE(delta->auth_credentials.get()); | 1542 ASSERT_TRUE(delta->auth_credentials.get()); |
1543 EXPECT_EQ(username, delta->auth_credentials->username()); | 1543 EXPECT_EQ(username, delta->auth_credentials->username()); |
1544 EXPECT_EQ(password, delta->auth_credentials->password()); | 1544 EXPECT_EQ(password, delta->auth_credentials->password()); |
1545 } | 1545 } |
1546 | 1546 |
1547 TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) { | 1547 TEST(ExtensionWebRequestHelpersTest, TestMergeCancelOfResponses) { |
1548 EventResponseDeltas deltas; | 1548 EventResponseDeltas deltas; |
1549 net::BoundTestNetLog capturing_net_log; | 1549 net::BoundTestNetLog capturing_net_log; |
1550 net::BoundNetLog net_log = capturing_net_log.bound(); | 1550 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1551 bool canceled = false; | 1551 bool canceled = false; |
1552 | 1552 |
1553 // Single event that does not cancel. | 1553 // Single event that does not cancel. |
1554 linked_ptr<EventResponseDelta> d1( | 1554 linked_ptr<EventResponseDelta> d1( |
1555 new EventResponseDelta("extid1", base::Time::FromInternalValue(1000))); | 1555 new EventResponseDelta("extid1", base::Time::FromInternalValue(1000))); |
1556 d1->cancel = false; | 1556 d1->cancel = false; |
1557 deltas.push_back(d1); | 1557 deltas.push_back(d1); |
1558 MergeCancelOfResponses(deltas, &canceled, &net_log); | 1558 MergeCancelOfResponses(deltas, &canceled, &net_log); |
1559 EXPECT_FALSE(canceled); | 1559 EXPECT_FALSE(canceled); |
1560 EXPECT_EQ(0u, capturing_net_log.GetSize()); | 1560 EXPECT_EQ(0u, capturing_net_log.GetSize()); |
1561 | 1561 |
1562 // Second event that cancels the request | 1562 // Second event that cancels the request |
1563 linked_ptr<EventResponseDelta> d2( | 1563 linked_ptr<EventResponseDelta> d2( |
1564 new EventResponseDelta("extid2", base::Time::FromInternalValue(500))); | 1564 new EventResponseDelta("extid2", base::Time::FromInternalValue(500))); |
1565 d2->cancel = true; | 1565 d2->cancel = true; |
1566 deltas.push_back(d2); | 1566 deltas.push_back(d2); |
1567 deltas.sort(&InDecreasingExtensionInstallationTimeOrder); | 1567 deltas.sort(&InDecreasingExtensionInstallationTimeOrder); |
1568 MergeCancelOfResponses(deltas, &canceled, &net_log); | 1568 MergeCancelOfResponses(deltas, &canceled, &net_log); |
1569 EXPECT_TRUE(canceled); | 1569 EXPECT_TRUE(canceled); |
1570 EXPECT_EQ(1u, capturing_net_log.GetSize()); | 1570 EXPECT_EQ(1u, capturing_net_log.GetSize()); |
1571 } | 1571 } |
1572 | 1572 |
1573 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses) { | 1573 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses) { |
1574 EventResponseDeltas deltas; | 1574 EventResponseDeltas deltas; |
1575 net::BoundTestNetLog capturing_net_log; | 1575 net::BoundTestNetLog capturing_net_log; |
1576 net::BoundNetLog net_log = capturing_net_log.bound(); | 1576 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1577 WarningSet warning_set; | 1577 WarningSet warning_set; |
1578 GURL effective_new_url; | 1578 GURL effective_new_url; |
1579 | 1579 |
1580 // No redirect | 1580 // No redirect |
1581 linked_ptr<EventResponseDelta> d0( | 1581 linked_ptr<EventResponseDelta> d0( |
1582 new EventResponseDelta("extid0", base::Time::FromInternalValue(0))); | 1582 new EventResponseDelta("extid0", base::Time::FromInternalValue(0))); |
1583 deltas.push_back(d0); | 1583 deltas.push_back(d0); |
1584 MergeOnBeforeRequestResponses( | 1584 MergeOnBeforeRequestResponses( |
1585 deltas, &effective_new_url, &warning_set, &net_log); | 1585 deltas, &effective_new_url, &warning_set, &net_log); |
1586 EXPECT_TRUE(effective_new_url.is_empty()); | 1586 EXPECT_TRUE(effective_new_url.is_empty()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 EXPECT_TRUE(HasWarning(warning_set, "extid1")); | 1647 EXPECT_TRUE(HasWarning(warning_set, "extid1")); |
1648 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 1648 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
1649 EXPECT_EQ(4u, capturing_net_log.GetSize()); | 1649 EXPECT_EQ(4u, capturing_net_log.GetSize()); |
1650 } | 1650 } |
1651 | 1651 |
1652 // This tests that we can redirect to data:// urls, which is considered | 1652 // This tests that we can redirect to data:// urls, which is considered |
1653 // a kind of cancelling requests. | 1653 // a kind of cancelling requests. |
1654 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) { | 1654 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses2) { |
1655 EventResponseDeltas deltas; | 1655 EventResponseDeltas deltas; |
1656 net::BoundTestNetLog capturing_net_log; | 1656 net::BoundTestNetLog capturing_net_log; |
1657 net::BoundNetLog net_log = capturing_net_log.bound(); | 1657 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1658 WarningSet warning_set; | 1658 WarningSet warning_set; |
1659 GURL effective_new_url; | 1659 GURL effective_new_url; |
1660 | 1660 |
1661 // Single redirect. | 1661 // Single redirect. |
1662 GURL new_url_0("http://foo.com"); | 1662 GURL new_url_0("http://foo.com"); |
1663 linked_ptr<EventResponseDelta> d0( | 1663 linked_ptr<EventResponseDelta> d0( |
1664 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000))); | 1664 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000))); |
1665 d0->new_url = GURL(new_url_0); | 1665 d0->new_url = GURL(new_url_0); |
1666 deltas.push_back(d0); | 1666 deltas.push_back(d0); |
1667 MergeOnBeforeRequestResponses( | 1667 MergeOnBeforeRequestResponses( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 EXPECT_EQ(1u, warning_set.size()); | 1716 EXPECT_EQ(1u, warning_set.size()); |
1717 EXPECT_TRUE(HasWarning(warning_set, "extid3")); | 1717 EXPECT_TRUE(HasWarning(warning_set, "extid3")); |
1718 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 1718 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
1719 } | 1719 } |
1720 | 1720 |
1721 // This tests that we can redirect to about:blank, which is considered | 1721 // This tests that we can redirect to about:blank, which is considered |
1722 // a kind of cancelling requests. | 1722 // a kind of cancelling requests. |
1723 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses3) { | 1723 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeRequestResponses3) { |
1724 EventResponseDeltas deltas; | 1724 EventResponseDeltas deltas; |
1725 net::BoundTestNetLog capturing_net_log; | 1725 net::BoundTestNetLog capturing_net_log; |
1726 net::BoundNetLog net_log = capturing_net_log.bound(); | 1726 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1727 WarningSet warning_set; | 1727 WarningSet warning_set; |
1728 GURL effective_new_url; | 1728 GURL effective_new_url; |
1729 | 1729 |
1730 // Single redirect. | 1730 // Single redirect. |
1731 GURL new_url_0("http://foo.com"); | 1731 GURL new_url_0("http://foo.com"); |
1732 linked_ptr<EventResponseDelta> d0( | 1732 linked_ptr<EventResponseDelta> d0( |
1733 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000))); | 1733 new EventResponseDelta("extid0", base::Time::FromInternalValue(2000))); |
1734 d0->new_url = GURL(new_url_0); | 1734 d0->new_url = GURL(new_url_0); |
1735 deltas.push_back(d0); | 1735 deltas.push_back(d0); |
1736 MergeOnBeforeRequestResponses( | 1736 MergeOnBeforeRequestResponses( |
(...skipping 15 matching lines...) Expand all Loading... |
1752 EXPECT_EQ(new_url_1, effective_new_url); | 1752 EXPECT_EQ(new_url_1, effective_new_url); |
1753 EXPECT_TRUE(warning_set.empty()); | 1753 EXPECT_TRUE(warning_set.empty()); |
1754 EXPECT_EQ(1u, capturing_net_log.GetSize()); | 1754 EXPECT_EQ(1u, capturing_net_log.GetSize()); |
1755 } | 1755 } |
1756 | 1756 |
1757 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) { | 1757 TEST(ExtensionWebRequestHelpersTest, TestMergeOnBeforeSendHeadersResponses) { |
1758 net::HttpRequestHeaders base_headers; | 1758 net::HttpRequestHeaders base_headers; |
1759 base_headers.SetHeader("key1", "value 1"); | 1759 base_headers.SetHeader("key1", "value 1"); |
1760 base_headers.SetHeader("key2", "value 2"); | 1760 base_headers.SetHeader("key2", "value 2"); |
1761 net::BoundTestNetLog capturing_net_log; | 1761 net::BoundTestNetLog capturing_net_log; |
1762 net::BoundNetLog net_log = capturing_net_log.bound(); | 1762 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1763 WarningSet warning_set; | 1763 WarningSet warning_set; |
1764 std::string header_value; | 1764 std::string header_value; |
1765 EventResponseDeltas deltas; | 1765 EventResponseDeltas deltas; |
1766 | 1766 |
1767 // Check that we can handle not changing the headers. | 1767 // Check that we can handle not changing the headers. |
1768 linked_ptr<EventResponseDelta> d0( | 1768 linked_ptr<EventResponseDelta> d0( |
1769 new EventResponseDelta("extid0", base::Time::FromInternalValue(2500))); | 1769 new EventResponseDelta("extid0", base::Time::FromInternalValue(2500))); |
1770 deltas.push_back(d0); | 1770 deltas.push_back(d0); |
1771 net::HttpRequestHeaders headers0; | 1771 net::HttpRequestHeaders headers0; |
1772 headers0.MergeFrom(base_headers); | 1772 headers0.MergeFrom(base_headers); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 1848 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
1849 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 1849 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
1850 } | 1850 } |
1851 | 1851 |
1852 TEST(ExtensionWebRequestHelpersTest, | 1852 TEST(ExtensionWebRequestHelpersTest, |
1853 TestMergeOnBeforeSendHeadersResponses_Cookies) { | 1853 TestMergeOnBeforeSendHeadersResponses_Cookies) { |
1854 net::HttpRequestHeaders base_headers; | 1854 net::HttpRequestHeaders base_headers; |
1855 base_headers.AddHeaderFromString( | 1855 base_headers.AddHeaderFromString( |
1856 "Cookie: name=value; name2=value2; name3=\"value3\""); | 1856 "Cookie: name=value; name2=value2; name3=\"value3\""); |
1857 net::BoundTestNetLog capturing_net_log; | 1857 net::BoundTestNetLog capturing_net_log; |
1858 net::BoundNetLog net_log = capturing_net_log.bound(); | 1858 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1859 WarningSet warning_set; | 1859 WarningSet warning_set; |
1860 std::string header_value; | 1860 std::string header_value; |
1861 EventResponseDeltas deltas; | 1861 EventResponseDeltas deltas; |
1862 | 1862 |
1863 linked_ptr<RequestCookieModification> add_cookie = | 1863 linked_ptr<RequestCookieModification> add_cookie = |
1864 make_linked_ptr(new RequestCookieModification); | 1864 make_linked_ptr(new RequestCookieModification); |
1865 add_cookie->type = helpers::ADD; | 1865 add_cookie->type = helpers::ADD; |
1866 add_cookie->modification.reset(new helpers::RequestCookie); | 1866 add_cookie->modification.reset(new helpers::RequestCookie); |
1867 add_cookie->modification->name.reset(new std::string("name4")); | 1867 add_cookie->modification->name.reset(new std::string("name4")); |
1868 add_cookie->modification->value.reset(new std::string("\"value 4\"")); | 1868 add_cookie->modification->value.reset(new std::string("\"value 4\"")); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 exploded_time.hour, | 1932 exploded_time.hour, |
1933 exploded_time.minute, | 1933 exploded_time.minute, |
1934 exploded_time.second); | 1934 exploded_time.second); |
1935 } | 1935 } |
1936 | 1936 |
1937 } // namespace | 1937 } // namespace |
1938 | 1938 |
1939 TEST(ExtensionWebRequestHelpersTest, | 1939 TEST(ExtensionWebRequestHelpersTest, |
1940 TestMergeCookiesInOnHeadersReceivedResponses) { | 1940 TestMergeCookiesInOnHeadersReceivedResponses) { |
1941 net::BoundTestNetLog capturing_net_log; | 1941 net::BoundTestNetLog capturing_net_log; |
1942 net::BoundNetLog net_log = capturing_net_log.bound(); | 1942 net::NetLogWithSource net_log = capturing_net_log.bound(); |
1943 WarningSet warning_set; | 1943 WarningSet warning_set; |
1944 std::string header_value; | 1944 std::string header_value; |
1945 EventResponseDeltas deltas; | 1945 EventResponseDeltas deltas; |
1946 | 1946 |
1947 std::string cookie_expiration = GetCookieExpirationDate(1200); | 1947 std::string cookie_expiration = GetCookieExpirationDate(1200); |
1948 std::string base_headers_string = | 1948 std::string base_headers_string = |
1949 "HTTP/1.0 200 OK\r\n" | 1949 "HTTP/1.0 200 OK\r\n" |
1950 "Foo: Bar\r\n" | 1950 "Foo: Bar\r\n" |
1951 "Set-Cookie: name=value; DOMAIN=google.com; Secure\r\n" | 1951 "Set-Cookie: name=value; DOMAIN=google.com; Secure\r\n" |
1952 "Set-Cookie: name2=value2\r\n" | 1952 "Set-Cookie: name2=value2\r\n" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 std::set<std::string> actual_cookies; | 2167 std::set<std::string> actual_cookies; |
2168 while (new_headers1->EnumerateHeader(&iter, "Set-Cookie", &cookie_string)) | 2168 while (new_headers1->EnumerateHeader(&iter, "Set-Cookie", &cookie_string)) |
2169 actual_cookies.insert(cookie_string); | 2169 actual_cookies.insert(cookie_string); |
2170 EXPECT_EQ(expected_cookies, actual_cookies); | 2170 EXPECT_EQ(expected_cookies, actual_cookies); |
2171 EXPECT_EQ(0u, warning_set.size()); | 2171 EXPECT_EQ(0u, warning_set.size()); |
2172 EXPECT_EQ(0u, capturing_net_log.GetSize()); | 2172 EXPECT_EQ(0u, capturing_net_log.GetSize()); |
2173 } | 2173 } |
2174 | 2174 |
2175 TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) { | 2175 TEST(ExtensionWebRequestHelpersTest, TestMergeOnHeadersReceivedResponses) { |
2176 net::BoundTestNetLog capturing_net_log; | 2176 net::BoundTestNetLog capturing_net_log; |
2177 net::BoundNetLog net_log = capturing_net_log.bound(); | 2177 net::NetLogWithSource net_log = capturing_net_log.bound(); |
2178 WarningSet warning_set; | 2178 WarningSet warning_set; |
2179 std::string header_value; | 2179 std::string header_value; |
2180 EventResponseDeltas deltas; | 2180 EventResponseDeltas deltas; |
2181 | 2181 |
2182 char base_headers_string[] = | 2182 char base_headers_string[] = |
2183 "HTTP/1.0 200 OK\r\n" | 2183 "HTTP/1.0 200 OK\r\n" |
2184 "Key1: Value1\r\n" | 2184 "Key1: Value1\r\n" |
2185 "Key2: Value2, Foo\r\n" | 2185 "Key2: Value2, Foo\r\n" |
2186 "\r\n"; | 2186 "\r\n"; |
2187 scoped_refptr<net::HttpResponseHeaders> base_headers( | 2187 scoped_refptr<net::HttpResponseHeaders> base_headers( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 EXPECT_EQ(expected1, actual2); | 2267 EXPECT_EQ(expected1, actual2); |
2268 EXPECT_EQ(1u, warning_set.size()); | 2268 EXPECT_EQ(1u, warning_set.size()); |
2269 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2269 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
2270 EXPECT_EQ(2u, capturing_net_log.GetSize()); | 2270 EXPECT_EQ(2u, capturing_net_log.GetSize()); |
2271 } | 2271 } |
2272 | 2272 |
2273 // Check that we do not delete too much | 2273 // Check that we do not delete too much |
2274 TEST(ExtensionWebRequestHelpersTest, | 2274 TEST(ExtensionWebRequestHelpersTest, |
2275 TestMergeOnHeadersReceivedResponsesDeletion) { | 2275 TestMergeOnHeadersReceivedResponsesDeletion) { |
2276 net::BoundTestNetLog capturing_net_log; | 2276 net::BoundTestNetLog capturing_net_log; |
2277 net::BoundNetLog net_log = capturing_net_log.bound(); | 2277 net::NetLogWithSource net_log = capturing_net_log.bound(); |
2278 WarningSet warning_set; | 2278 WarningSet warning_set; |
2279 std::string header_value; | 2279 std::string header_value; |
2280 EventResponseDeltas deltas; | 2280 EventResponseDeltas deltas; |
2281 | 2281 |
2282 char base_headers_string[] = | 2282 char base_headers_string[] = |
2283 "HTTP/1.0 200 OK\r\n" | 2283 "HTTP/1.0 200 OK\r\n" |
2284 "Key1: Value1\r\n" | 2284 "Key1: Value1\r\n" |
2285 "Key1: Value2\r\n" | 2285 "Key1: Value2\r\n" |
2286 "Key1: Value3\r\n" | 2286 "Key1: Value3\r\n" |
2287 "Key2: Value4\r\n" | 2287 "Key2: Value4\r\n" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 EXPECT_EQ(1u, capturing_net_log.GetSize()); | 2321 EXPECT_EQ(1u, capturing_net_log.GetSize()); |
2322 } | 2322 } |
2323 | 2323 |
2324 // Tests whether onHeadersReceived can initiate a redirect. | 2324 // Tests whether onHeadersReceived can initiate a redirect. |
2325 // The URL merge logic is shared with onBeforeRequest, so we only need to test | 2325 // The URL merge logic is shared with onBeforeRequest, so we only need to test |
2326 // whether the URLs are merged at all. | 2326 // whether the URLs are merged at all. |
2327 TEST(ExtensionWebRequestHelpersTest, | 2327 TEST(ExtensionWebRequestHelpersTest, |
2328 TestMergeOnHeadersReceivedResponsesRedirect) { | 2328 TestMergeOnHeadersReceivedResponsesRedirect) { |
2329 EventResponseDeltas deltas; | 2329 EventResponseDeltas deltas; |
2330 net::BoundTestNetLog capturing_net_log; | 2330 net::BoundTestNetLog capturing_net_log; |
2331 net::BoundNetLog net_log = capturing_net_log.bound(); | 2331 net::NetLogWithSource net_log = capturing_net_log.bound(); |
2332 WarningSet warning_set; | 2332 WarningSet warning_set; |
2333 | 2333 |
2334 char base_headers_string[] = | 2334 char base_headers_string[] = |
2335 "HTTP/1.0 200 OK\r\n" | 2335 "HTTP/1.0 200 OK\r\n" |
2336 "\r\n"; | 2336 "\r\n"; |
2337 scoped_refptr<net::HttpResponseHeaders> base_headers( | 2337 scoped_refptr<net::HttpResponseHeaders> base_headers( |
2338 new net::HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders( | 2338 new net::HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders( |
2339 base_headers_string, sizeof(base_headers_string)))); | 2339 base_headers_string, sizeof(base_headers_string)))); |
2340 | 2340 |
2341 // No redirect | 2341 // No redirect |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 | 2374 |
2375 EXPECT_TRUE(new_headers1.get()); | 2375 EXPECT_TRUE(new_headers1.get()); |
2376 EXPECT_TRUE(new_headers1->HasHeaderValue("Location", new_url_1.spec())); | 2376 EXPECT_TRUE(new_headers1->HasHeaderValue("Location", new_url_1.spec())); |
2377 EXPECT_EQ(new_url_1, allowed_unsafe_redirect_url1); | 2377 EXPECT_EQ(new_url_1, allowed_unsafe_redirect_url1); |
2378 EXPECT_TRUE(warning_set.empty()); | 2378 EXPECT_TRUE(warning_set.empty()); |
2379 EXPECT_EQ(1u, capturing_net_log.GetSize()); | 2379 EXPECT_EQ(1u, capturing_net_log.GetSize()); |
2380 } | 2380 } |
2381 | 2381 |
2382 TEST(ExtensionWebRequestHelpersTest, TestMergeOnAuthRequiredResponses) { | 2382 TEST(ExtensionWebRequestHelpersTest, TestMergeOnAuthRequiredResponses) { |
2383 net::BoundTestNetLog capturing_net_log; | 2383 net::BoundTestNetLog capturing_net_log; |
2384 net::BoundNetLog net_log = capturing_net_log.bound(); | 2384 net::NetLogWithSource net_log = capturing_net_log.bound(); |
2385 WarningSet warning_set; | 2385 WarningSet warning_set; |
2386 EventResponseDeltas deltas; | 2386 EventResponseDeltas deltas; |
2387 base::string16 username = base::ASCIIToUTF16("foo"); | 2387 base::string16 username = base::ASCIIToUTF16("foo"); |
2388 base::string16 password = base::ASCIIToUTF16("bar"); | 2388 base::string16 password = base::ASCIIToUTF16("bar"); |
2389 base::string16 password2 = base::ASCIIToUTF16("baz"); | 2389 base::string16 password2 = base::ASCIIToUTF16("baz"); |
2390 | 2390 |
2391 // Check that we can handle if not returning credentials. | 2391 // Check that we can handle if not returning credentials. |
2392 linked_ptr<EventResponseDelta> d0( | 2392 linked_ptr<EventResponseDelta> d0( |
2393 new EventResponseDelta("extid0", base::Time::FromInternalValue(3000))); | 2393 new EventResponseDelta("extid0", base::Time::FromInternalValue(3000))); |
2394 deltas.push_back(d0); | 2394 deltas.push_back(d0); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2452 EXPECT_TRUE(credentials_set); | 2452 EXPECT_TRUE(credentials_set); |
2453 EXPECT_FALSE(auth3.Empty()); | 2453 EXPECT_FALSE(auth3.Empty()); |
2454 EXPECT_EQ(username, auth1.username()); | 2454 EXPECT_EQ(username, auth1.username()); |
2455 EXPECT_EQ(password, auth1.password()); | 2455 EXPECT_EQ(password, auth1.password()); |
2456 EXPECT_EQ(1u, warning_set.size()); | 2456 EXPECT_EQ(1u, warning_set.size()); |
2457 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2457 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
2458 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2458 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
2459 } | 2459 } |
2460 | 2460 |
2461 } // namespace extensions | 2461 } // namespace extensions |
OLD | NEW |