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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 7758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7769 | 7769 |
7770 // The response will look like; | 7770 // The response will look like; |
7771 // insert abc | 7771 // insert abc |
7772 // lookup abc | 7772 // lookup abc |
7773 // insert xyz | 7773 // insert xyz |
7774 // | 7774 // |
7775 // With a newline at the end which makes the split think that there are | 7775 // With a newline at the end which makes the split think that there are |
7776 // four lines. | 7776 // four lines. |
7777 | 7777 |
7778 EXPECT_EQ(1, d.response_started_count()); | 7778 EXPECT_EQ(1, d.response_started_count()); |
7779 std::vector<std::string> lines; | 7779 std::vector<std::string> lines = base::SplitString( |
7780 base::SplitString(d.data_received(), '\n', &lines); | 7780 d.data_received(), "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
7781 ASSERT_EQ(4u, lines.size()) << d.data_received(); | 7781 ASSERT_EQ(4u, lines.size()) << d.data_received(); |
7782 | 7782 |
7783 std::string session_id; | 7783 std::string session_id; |
7784 | 7784 |
7785 for (size_t i = 0; i < 2; i++) { | 7785 for (size_t i = 0; i < 2; i++) { |
7786 std::vector<std::string> parts; | 7786 std::vector<std::string> parts = base::SplitString( |
7787 base::SplitString(lines[i], '\t', &parts); | 7787 lines[i], "\t", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
7788 ASSERT_EQ(2u, parts.size()); | 7788 ASSERT_EQ(2u, parts.size()); |
7789 if (i == 0) { | 7789 if (i == 0) { |
7790 EXPECT_EQ("insert", parts[0]); | 7790 EXPECT_EQ("insert", parts[0]); |
7791 session_id = parts[1]; | 7791 session_id = parts[1]; |
7792 } else { | 7792 } else { |
7793 EXPECT_EQ("lookup", parts[0]); | 7793 EXPECT_EQ("lookup", parts[0]); |
7794 EXPECT_EQ(session_id, parts[1]); | 7794 EXPECT_EQ(session_id, parts[1]); |
7795 } | 7795 } |
7796 } | 7796 } |
7797 } | 7797 } |
7798 } | 7798 } |
7799 | 7799 |
7800 // AssertTwoDistinctSessionsInserted checks that |session_info|, which must be | 7800 // AssertTwoDistinctSessionsInserted checks that |session_info|, which must be |
7801 // the result of fetching "ssl-session-cache" from the test server, indicates | 7801 // the result of fetching "ssl-session-cache" from the test server, indicates |
7802 // that exactly two different sessions were inserted, with no lookups etc. | 7802 // that exactly two different sessions were inserted, with no lookups etc. |
7803 static void AssertTwoDistinctSessionsInserted(const string& session_info) { | 7803 static void AssertTwoDistinctSessionsInserted(const string& session_info) { |
7804 std::vector<std::string> lines; | 7804 std::vector<std::string> lines = base::SplitString( |
7805 base::SplitString(session_info, '\n', &lines); | 7805 session_info, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
7806 ASSERT_EQ(3u, lines.size()) << session_info; | 7806 ASSERT_EQ(3u, lines.size()) << session_info; |
7807 | 7807 |
7808 std::string session_id; | 7808 std::string session_id; |
7809 for (size_t i = 0; i < 2; i++) { | 7809 for (size_t i = 0; i < 2; i++) { |
7810 std::vector<std::string> parts; | 7810 std::vector<std::string> parts = base::SplitString( |
7811 base::SplitString(lines[i], '\t', &parts); | 7811 lines[i], "\t", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
7812 ASSERT_EQ(2u, parts.size()); | 7812 ASSERT_EQ(2u, parts.size()); |
7813 EXPECT_EQ("insert", parts[0]); | 7813 EXPECT_EQ("insert", parts[0]); |
7814 if (i == 0) { | 7814 if (i == 0) { |
7815 session_id = parts[1]; | 7815 session_id = parts[1]; |
7816 } else { | 7816 } else { |
7817 EXPECT_NE(session_id, parts[1]); | 7817 EXPECT_NE(session_id, parts[1]); |
7818 } | 7818 } |
7819 } | 7819 } |
7820 } | 7820 } |
7821 | 7821 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7917 | 7917 |
7918 TestDelegate d; | 7918 TestDelegate d; |
7919 scoped_ptr<URLRequest> r(default_context_.CreateRequest( | 7919 scoped_ptr<URLRequest> r(default_context_.CreateRequest( |
7920 test_server.GetURL("client-cipher-list"), DEFAULT_PRIORITY, &d)); | 7920 test_server.GetURL("client-cipher-list"), DEFAULT_PRIORITY, &d)); |
7921 r->Start(); | 7921 r->Start(); |
7922 EXPECT_TRUE(r->is_pending()); | 7922 EXPECT_TRUE(r->is_pending()); |
7923 | 7923 |
7924 base::RunLoop().Run(); | 7924 base::RunLoop().Run(); |
7925 | 7925 |
7926 EXPECT_EQ(1, d.response_started_count()); | 7926 EXPECT_EQ(1, d.response_started_count()); |
7927 std::vector<std::string> lines; | 7927 std::vector<std::string> lines = base::SplitString( |
7928 base::SplitString(d.data_received(), '\n', &lines); | 7928 d.data_received(), "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
7929 | 7929 |
7930 for (size_t i = 0; i < lines.size(); i++) { | 7930 for (size_t i = 0; i < lines.size(); i++) { |
7931 int cipher_suite; | 7931 int cipher_suite; |
7932 ASSERT_TRUE(base::StringToInt(lines[i], &cipher_suite)); | 7932 ASSERT_TRUE(base::StringToInt(lines[i], &cipher_suite)); |
7933 EXPECT_FALSE(IsECDSACipherSuite(cipher_suite)) | 7933 EXPECT_FALSE(IsECDSACipherSuite(cipher_suite)) |
7934 << "ClientHello advertised " << cipher_suite; | 7934 << "ClientHello advertised " << cipher_suite; |
7935 } | 7935 } |
7936 } | 7936 } |
7937 | 7937 |
7938 #endif // OS_WIN | 7938 #endif // OS_WIN |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9204 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d)); | 9204 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d)); |
9205 | 9205 |
9206 EXPECT_FALSE(req->response_info().network_accessed); | 9206 EXPECT_FALSE(req->response_info().network_accessed); |
9207 | 9207 |
9208 req->Start(); | 9208 req->Start(); |
9209 base::RunLoop().Run(); | 9209 base::RunLoop().Run(); |
9210 EXPECT_TRUE(req->response_info().network_accessed); | 9210 EXPECT_TRUE(req->response_info().network_accessed); |
9211 } | 9211 } |
9212 | 9212 |
9213 } // namespace net | 9213 } // namespace net |
OLD | NEW |