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

Side by Side Diff: net/spdy/chromium/spdy_session_unittest.cc

Issue 2847133003: Add NetLog event for invalid Http/2 response header (Closed)
Patch Set: address comments Created 3 years, 7 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/spdy/chromium/spdy_session.cc ('k') | net/spdy/chromium/spdy_test_util_common.cc » ('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) 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 "net/spdy/chromium/spdy_session.h" 5 #include "net/spdy/chromium/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2844 } 2844 }
2845 2845
2846 // Test that SpdySession::DoReadLoop reads data from the socket 2846 // Test that SpdySession::DoReadLoop reads data from the socket
2847 // without yielding. This test makes 32k - 1 bytes of data available 2847 // without yielding. This test makes 32k - 1 bytes of data available
2848 // on the socket for reading. It then verifies that it has read all 2848 // on the socket for reading. It then verifies that it has read all
2849 // the available data without yielding. 2849 // the available data without yielding.
2850 TEST_F(SpdySessionTest, ReadDataWithoutYielding) { 2850 TEST_F(SpdySessionTest, ReadDataWithoutYielding) {
2851 session_deps_.host_resolver->set_synchronous_mode(true); 2851 session_deps_.host_resolver->set_synchronous_mode(true);
2852 session_deps_.time_func = InstantaneousReads; 2852 session_deps_.time_func = InstantaneousReads;
2853 2853
2854 BufferedSpdyFramer framer; 2854 NetLogWithSource net_log;
2855 BufferedSpdyFramer framer(net_log);
2855 2856
2856 SpdySerializedFrame req1( 2857 SpdySerializedFrame req1(
2857 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, MEDIUM, true)); 2858 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, MEDIUM, true));
2858 MockWrite writes[] = { 2859 MockWrite writes[] = {
2859 CreateMockWrite(req1, 0), 2860 CreateMockWrite(req1, 0),
2860 }; 2861 };
2861 2862
2862 // Build buffer of size kYieldAfterBytesRead / 4 2863 // Build buffer of size kYieldAfterBytesRead / 4
2863 // (-spdy_data_frame_size). 2864 // (-spdy_data_frame_size).
2864 ASSERT_EQ(32 * 1024, kYieldAfterBytesRead); 2865 ASSERT_EQ(32 * 1024, kYieldAfterBytesRead);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 3058
3058 // Test that SpdySession::DoReadLoop yields while reading the 3059 // Test that SpdySession::DoReadLoop yields while reading the
3059 // data. This test makes 32k + 1 bytes of data available on the socket 3060 // data. This test makes 32k + 1 bytes of data available on the socket
3060 // for reading. It then verifies that DoRead has yielded even though 3061 // for reading. It then verifies that DoRead has yielded even though
3061 // there is data available for it to read (i.e, socket()->Read didn't 3062 // there is data available for it to read (i.e, socket()->Read didn't
3062 // return ERR_IO_PENDING during socket reads). 3063 // return ERR_IO_PENDING during socket reads).
3063 TEST_F(SpdySessionTest, TestYieldingDuringReadData) { 3064 TEST_F(SpdySessionTest, TestYieldingDuringReadData) {
3064 session_deps_.host_resolver->set_synchronous_mode(true); 3065 session_deps_.host_resolver->set_synchronous_mode(true);
3065 session_deps_.time_func = InstantaneousReads; 3066 session_deps_.time_func = InstantaneousReads;
3066 3067
3067 BufferedSpdyFramer framer; 3068 NetLogWithSource net_log;
3069 BufferedSpdyFramer framer(net_log);
3068 3070
3069 SpdySerializedFrame req1( 3071 SpdySerializedFrame req1(
3070 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, MEDIUM, true)); 3072 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, MEDIUM, true));
3071 MockWrite writes[] = { 3073 MockWrite writes[] = {
3072 CreateMockWrite(req1, 0), 3074 CreateMockWrite(req1, 0),
3073 }; 3075 };
3074 3076
3075 // Build buffer of size kYieldAfterBytesRead / 4 3077 // Build buffer of size kYieldAfterBytesRead / 4
3076 // (-spdy_data_frame_size). 3078 // (-spdy_data_frame_size).
3077 ASSERT_EQ(32 * 1024, kYieldAfterBytesRead); 3079 ASSERT_EQ(32 * 1024, kYieldAfterBytesRead);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3151 // 3153 //
3152 // The above reads 26K synchronously. Since that is less that 32K, we 3154 // The above reads 26K synchronously. Since that is less that 32K, we
3153 // will attempt to read again. However, that DoRead() will return 3155 // will attempt to read again. However, that DoRead() will return
3154 // ERR_IO_PENDING (because of async read), so DoReadLoop() will 3156 // ERR_IO_PENDING (because of async read), so DoReadLoop() will
3155 // yield. When we come back, DoRead() will read the results from the 3157 // yield. When we come back, DoRead() will read the results from the
3156 // async read, and rest of the data synchronously. 3158 // async read, and rest of the data synchronously.
3157 TEST_F(SpdySessionTest, TestYieldingDuringAsyncReadData) { 3159 TEST_F(SpdySessionTest, TestYieldingDuringAsyncReadData) {
3158 session_deps_.host_resolver->set_synchronous_mode(true); 3160 session_deps_.host_resolver->set_synchronous_mode(true);
3159 session_deps_.time_func = InstantaneousReads; 3161 session_deps_.time_func = InstantaneousReads;
3160 3162
3161 BufferedSpdyFramer framer; 3163 NetLogWithSource net_log;
3164 BufferedSpdyFramer framer(net_log);
3162 3165
3163 SpdySerializedFrame req1( 3166 SpdySerializedFrame req1(
3164 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, MEDIUM, true)); 3167 spdy_util_.ConstructSpdyGet(nullptr, 0, 1, MEDIUM, true));
3165 MockWrite writes[] = { 3168 MockWrite writes[] = {
3166 CreateMockWrite(req1, 0), 3169 CreateMockWrite(req1, 0),
3167 }; 3170 };
3168 3171
3169 // Build buffer of size kYieldAfterBytesRead / 4 3172 // Build buffer of size kYieldAfterBytesRead / 4
3170 // (-spdy_data_frame_size). 3173 // (-spdy_data_frame_size).
3171 ASSERT_EQ(32 * 1024, kYieldAfterBytesRead); 3174 ASSERT_EQ(32 * 1024, kYieldAfterBytesRead);
(...skipping 2971 matching lines...) Expand 10 before | Expand all | Expand 10 after
6143 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 6146 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
6144 "spdy_pooling.pem"); 6147 "spdy_pooling.pem");
6145 ssl_info.is_issued_by_known_root = true; 6148 ssl_info.is_issued_by_known_root = true;
6146 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 6149 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
6147 6150
6148 EXPECT_TRUE(SpdySession::CanPool( 6151 EXPECT_TRUE(SpdySession::CanPool(
6149 &tss, ssl_info, "www.example.org", "mail.example.org")); 6152 &tss, ssl_info, "www.example.org", "mail.example.org"));
6150 } 6153 }
6151 6154
6152 } // namespace net 6155 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/chromium/spdy_session.cc ('k') | net/spdy/chromium/spdy_test_util_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698