| 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 "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); | 928 scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); |
| 929 scoped_ptr<SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 3)); | 929 scoped_ptr<SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 3)); |
| 930 scoped_ptr<SpdyFrame> body2(ConstructSpdyBodyFrame(3, false)); | 930 scoped_ptr<SpdyFrame> body2(ConstructSpdyBodyFrame(3, false)); |
| 931 scoped_ptr<SpdyFrame> fbody2(ConstructSpdyBodyFrame(3, true)); | 931 scoped_ptr<SpdyFrame> fbody2(ConstructSpdyBodyFrame(3, true)); |
| 932 | 932 |
| 933 scoped_ptr<SpdyFrame> req3(ConstructSpdyGet(NULL, 0, false, 5, LOWEST)); | 933 scoped_ptr<SpdyFrame> req3(ConstructSpdyGet(NULL, 0, false, 5, LOWEST)); |
| 934 scoped_ptr<SpdyFrame> resp3(ConstructSpdyGetSynReply(NULL, 0, 5)); | 934 scoped_ptr<SpdyFrame> resp3(ConstructSpdyGetSynReply(NULL, 0, 5)); |
| 935 scoped_ptr<SpdyFrame> body3(ConstructSpdyBodyFrame(5, false)); | 935 scoped_ptr<SpdyFrame> body3(ConstructSpdyBodyFrame(5, false)); |
| 936 scoped_ptr<SpdyFrame> fbody3(ConstructSpdyBodyFrame(5, true)); | 936 scoped_ptr<SpdyFrame> fbody3(ConstructSpdyBodyFrame(5, true)); |
| 937 | 937 |
| 938 SpdySettings settings; | 938 SettingsMap settings; |
| 939 SettingsFlagsAndId id(SETTINGS_FLAG_NONE, SETTINGS_MAX_CONCURRENT_STREAMS); | |
| 940 const size_t max_concurrent_streams = 1; | 939 const size_t max_concurrent_streams = 1; |
| 941 | 940 settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 942 settings.push_back(SpdySetting(id, max_concurrent_streams)); | 941 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); |
| 943 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); | 942 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
| 944 | 943 |
| 945 MockWrite writes[] = { | 944 MockWrite writes[] = { |
| 946 CreateMockWrite(*req), | 945 CreateMockWrite(*req), |
| 947 CreateMockWrite(*req2), | 946 CreateMockWrite(*req2), |
| 948 CreateMockWrite(*req3), | 947 CreateMockWrite(*req3), |
| 949 }; | 948 }; |
| 950 | 949 |
| 951 MockRead reads[] = { | 950 MockRead reads[] = { |
| 952 CreateMockRead(*settings_frame, 1), | 951 CreateMockRead(*settings_frame, 1), |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 scoped_ptr<SpdyFrame> req4( | 1064 scoped_ptr<SpdyFrame> req4( |
| 1066 ConstructSpdyGet(NULL, 0, false, 5, HIGHEST)); | 1065 ConstructSpdyGet(NULL, 0, false, 5, HIGHEST)); |
| 1067 scoped_ptr<SpdyFrame> resp4(ConstructSpdyGetSynReply(NULL, 0, 5)); | 1066 scoped_ptr<SpdyFrame> resp4(ConstructSpdyGetSynReply(NULL, 0, 5)); |
| 1068 scoped_ptr<SpdyFrame> fbody4(ConstructSpdyBodyFrame(5, true)); | 1067 scoped_ptr<SpdyFrame> fbody4(ConstructSpdyBodyFrame(5, true)); |
| 1069 | 1068 |
| 1070 scoped_ptr<SpdyFrame> req3(ConstructSpdyGet(NULL, 0, false, 7, LOWEST)); | 1069 scoped_ptr<SpdyFrame> req3(ConstructSpdyGet(NULL, 0, false, 7, LOWEST)); |
| 1071 scoped_ptr<SpdyFrame> resp3(ConstructSpdyGetSynReply(NULL, 0, 7)); | 1070 scoped_ptr<SpdyFrame> resp3(ConstructSpdyGetSynReply(NULL, 0, 7)); |
| 1072 scoped_ptr<SpdyFrame> body3(ConstructSpdyBodyFrame(7, false)); | 1071 scoped_ptr<SpdyFrame> body3(ConstructSpdyBodyFrame(7, false)); |
| 1073 scoped_ptr<SpdyFrame> fbody3(ConstructSpdyBodyFrame(7, true)); | 1072 scoped_ptr<SpdyFrame> fbody3(ConstructSpdyBodyFrame(7, true)); |
| 1074 | 1073 |
| 1075 SpdySettings settings; | 1074 SettingsMap settings; |
| 1076 SettingsFlagsAndId id(SETTINGS_FLAG_NONE, SETTINGS_MAX_CONCURRENT_STREAMS); | |
| 1077 const size_t max_concurrent_streams = 1; | 1075 const size_t max_concurrent_streams = 1; |
| 1078 | 1076 settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 1079 settings.push_back(SpdySetting(id, max_concurrent_streams)); | 1077 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); |
| 1080 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); | 1078 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
| 1081 | 1079 |
| 1082 MockWrite writes[] = { CreateMockWrite(*req), | 1080 MockWrite writes[] = { CreateMockWrite(*req), |
| 1083 CreateMockWrite(*req2), | 1081 CreateMockWrite(*req2), |
| 1084 CreateMockWrite(*req4), | 1082 CreateMockWrite(*req4), |
| 1085 CreateMockWrite(*req3), | 1083 CreateMockWrite(*req3), |
| 1086 }; | 1084 }; |
| 1087 MockRead reads[] = { | 1085 MockRead reads[] = { |
| 1088 CreateMockRead(*settings_frame, 1), | 1086 CreateMockRead(*settings_frame, 1), |
| 1089 CreateMockRead(*resp), | 1087 CreateMockRead(*resp), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 1206 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 1209 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1207 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 1210 scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, false)); | 1208 scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, false)); |
| 1211 scoped_ptr<SpdyFrame> fbody(ConstructSpdyBodyFrame(1, true)); | 1209 scoped_ptr<SpdyFrame> fbody(ConstructSpdyBodyFrame(1, true)); |
| 1212 | 1210 |
| 1213 scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); | 1211 scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); |
| 1214 scoped_ptr<SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 3)); | 1212 scoped_ptr<SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 3)); |
| 1215 scoped_ptr<SpdyFrame> body2(ConstructSpdyBodyFrame(3, false)); | 1213 scoped_ptr<SpdyFrame> body2(ConstructSpdyBodyFrame(3, false)); |
| 1216 scoped_ptr<SpdyFrame> fbody2(ConstructSpdyBodyFrame(3, true)); | 1214 scoped_ptr<SpdyFrame> fbody2(ConstructSpdyBodyFrame(3, true)); |
| 1217 | 1215 |
| 1218 SpdySettings settings; | 1216 SettingsMap settings; |
| 1219 SettingsFlagsAndId id(SETTINGS_FLAG_NONE, SETTINGS_MAX_CONCURRENT_STREAMS); | |
| 1220 const size_t max_concurrent_streams = 1; | 1217 const size_t max_concurrent_streams = 1; |
| 1221 | 1218 settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 1222 settings.push_back(SpdySetting(id, max_concurrent_streams)); | 1219 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); |
| 1223 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); | 1220 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
| 1224 | 1221 |
| 1225 MockWrite writes[] = { CreateMockWrite(*req), | 1222 MockWrite writes[] = { CreateMockWrite(*req), |
| 1226 CreateMockWrite(*req2), | 1223 CreateMockWrite(*req2), |
| 1227 }; | 1224 }; |
| 1228 MockRead reads[] = { | 1225 MockRead reads[] = { |
| 1229 CreateMockRead(*settings_frame, 1), | 1226 CreateMockRead(*settings_frame, 1), |
| 1230 CreateMockRead(*resp), | 1227 CreateMockRead(*resp), |
| 1231 CreateMockRead(*body), | 1228 CreateMockRead(*body), |
| 1232 CreateMockRead(*fbody), | 1229 CreateMockRead(*fbody), |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentSocketClose) { | 1339 TEST_P(SpdyNetworkTransactionSpdy3Test, ThreeGetsWithMaxConcurrentSocketClose) { |
| 1343 // Construct the request. | 1340 // Construct the request. |
| 1344 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 1341 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 1345 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 1342 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 1346 scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, false)); | 1343 scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, false)); |
| 1347 scoped_ptr<SpdyFrame> fin_body(ConstructSpdyBodyFrame(1, true)); | 1344 scoped_ptr<SpdyFrame> fin_body(ConstructSpdyBodyFrame(1, true)); |
| 1348 | 1345 |
| 1349 scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); | 1346 scoped_ptr<SpdyFrame> req2(ConstructSpdyGet(NULL, 0, false, 3, LOWEST)); |
| 1350 scoped_ptr<SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 3)); | 1347 scoped_ptr<SpdyFrame> resp2(ConstructSpdyGetSynReply(NULL, 0, 3)); |
| 1351 | 1348 |
| 1352 SpdySettings settings; | 1349 SettingsMap settings; |
| 1353 SettingsFlagsAndId id(SETTINGS_FLAG_NONE, SETTINGS_MAX_CONCURRENT_STREAMS); | |
| 1354 const size_t max_concurrent_streams = 1; | 1350 const size_t max_concurrent_streams = 1; |
| 1355 | 1351 settings[SETTINGS_MAX_CONCURRENT_STREAMS] = |
| 1356 settings.push_back(SpdySetting(id, max_concurrent_streams)); | 1352 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, max_concurrent_streams); |
| 1357 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); | 1353 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
| 1358 | 1354 |
| 1359 MockWrite writes[] = { CreateMockWrite(*req), | 1355 MockWrite writes[] = { CreateMockWrite(*req), |
| 1360 CreateMockWrite(*req2), | 1356 CreateMockWrite(*req2), |
| 1361 }; | 1357 }; |
| 1362 MockRead reads[] = { | 1358 MockRead reads[] = { |
| 1363 CreateMockRead(*settings_frame, 1), | 1359 CreateMockRead(*settings_frame, 1), |
| 1364 CreateMockRead(*resp), | 1360 CreateMockRead(*resp), |
| 1365 CreateMockRead(*body), | 1361 CreateMockRead(*body), |
| 1366 CreateMockRead(*fin_body), | 1362 CreateMockRead(*fin_body), |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 scoped_array<MockWrite> writes(new MockWrite[num_writes]); | 2253 scoped_array<MockWrite> writes(new MockWrite[num_writes]); |
| 2258 size_t i = 0; | 2254 size_t i = 0; |
| 2259 writes[i] = CreateMockWrite(*req); | 2255 writes[i] = CreateMockWrite(*req); |
| 2260 for (i = 1; i < num_writes - 2; i++) | 2256 for (i = 1; i < num_writes - 2; i++) |
| 2261 writes[i] = CreateMockWrite(*body1); | 2257 writes[i] = CreateMockWrite(*body1); |
| 2262 writes[i++] = CreateMockWrite(*body2); | 2258 writes[i++] = CreateMockWrite(*body2); |
| 2263 writes[i] = CreateMockWrite(*body3); | 2259 writes[i] = CreateMockWrite(*body3); |
| 2264 | 2260 |
| 2265 // Construct read frame for SETTINGS that gives enough space to upload the | 2261 // Construct read frame for SETTINGS that gives enough space to upload the |
| 2266 // rest of the data. | 2262 // rest of the data. |
| 2267 SpdySettings settings; | 2263 SettingsMap settings; |
| 2268 SettingsFlagsAndId id(0, SETTINGS_INITIAL_WINDOW_SIZE); | 2264 settings[SETTINGS_INITIAL_WINDOW_SIZE] = |
| 2269 settings.push_back(SpdySetting(id, kSpdyStreamInitialWindowSize * 2)); | 2265 SettingsFlagsAndValue( |
| 2266 SETTINGS_FLAG_NONE, kSpdyStreamInitialWindowSize * 2); |
| 2270 scoped_ptr<SpdyFrame> settings_frame_large(ConstructSpdySettings(settings)); | 2267 scoped_ptr<SpdyFrame> settings_frame_large(ConstructSpdySettings(settings)); |
| 2271 scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); | 2268 scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); |
| 2272 MockRead reads[] = { | 2269 MockRead reads[] = { |
| 2273 CreateMockRead(*settings_frame_large), | 2270 CreateMockRead(*settings_frame_large), |
| 2274 CreateMockRead(*reply), | 2271 CreateMockRead(*reply), |
| 2275 CreateMockRead(*body2), | 2272 CreateMockRead(*body2), |
| 2276 CreateMockRead(*body3), | 2273 CreateMockRead(*body3), |
| 2277 MockRead(ASYNC, 0, 0) // EOF | 2274 MockRead(ASYNC, 0, 0) // EOF |
| 2278 }; | 2275 }; |
| 2279 | 2276 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 scoped_array<MockWrite> writes(new MockWrite[num_writes]); | 2351 scoped_array<MockWrite> writes(new MockWrite[num_writes]); |
| 2355 size_t i = 0; | 2352 size_t i = 0; |
| 2356 writes[i] = CreateMockWrite(*req); | 2353 writes[i] = CreateMockWrite(*req); |
| 2357 for (i = 1; i < num_writes - 2; i++) | 2354 for (i = 1; i < num_writes - 2; i++) |
| 2358 writes[i] = CreateMockWrite(*body1); | 2355 writes[i] = CreateMockWrite(*body1); |
| 2359 writes[i++] = CreateMockWrite(*body2); | 2356 writes[i++] = CreateMockWrite(*body2); |
| 2360 writes[i] = CreateMockWrite(*body3); | 2357 writes[i] = CreateMockWrite(*body3); |
| 2361 | 2358 |
| 2362 // Construct read frame for SETTINGS that makes the send_window_size | 2359 // Construct read frame for SETTINGS that makes the send_window_size |
| 2363 // negative. | 2360 // negative. |
| 2364 SpdySettings new_settings; | 2361 SettingsMap new_settings; |
| 2365 SettingsFlagsAndId new_id(0, SETTINGS_INITIAL_WINDOW_SIZE); | 2362 new_settings[SETTINGS_INITIAL_WINDOW_SIZE] = |
| 2366 new_settings.push_back(SpdySetting(new_id, kSpdyStreamInitialWindowSize / 2)); | 2363 SettingsFlagsAndValue( |
| 2364 SETTINGS_FLAG_NONE, kSpdyStreamInitialWindowSize / 2); |
| 2367 scoped_ptr<SpdyFrame> settings_frame_small( | 2365 scoped_ptr<SpdyFrame> settings_frame_small( |
| 2368 ConstructSpdySettings(new_settings)); | 2366 ConstructSpdySettings(new_settings)); |
| 2369 // Construct read frame for WINDOW_UPDATE that makes the send_window_size | 2367 // Construct read frame for WINDOW_UPDATE that makes the send_window_size |
| 2370 // postive. | 2368 // postive. |
| 2371 scoped_ptr<SpdyFrame> window_update_init_size( | 2369 scoped_ptr<SpdyFrame> window_update_init_size( |
| 2372 ConstructSpdyWindowUpdate(1, kSpdyStreamInitialWindowSize)); | 2370 ConstructSpdyWindowUpdate(1, kSpdyStreamInitialWindowSize)); |
| 2373 scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); | 2371 scoped_ptr<SpdyFrame> reply(ConstructSpdyPostSynReply(NULL, 0)); |
| 2374 MockRead reads[] = { | 2372 MockRead reads[] = { |
| 2375 CreateMockRead(*settings_frame_small), | 2373 CreateMockRead(*settings_frame_small), |
| 2376 CreateMockRead(*window_update_init_size), | 2374 CreateMockRead(*window_update_init_size), |
| (...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4623 | 4621 |
| 4624 // Flush the MessageLoop; this will cause the buffered IO task | 4622 // Flush the MessageLoop; this will cause the buffered IO task |
| 4625 // to run for the final time. | 4623 // to run for the final time. |
| 4626 MessageLoop::current()->RunAllPending(); | 4624 MessageLoop::current()->RunAllPending(); |
| 4627 | 4625 |
| 4628 // Verify that we consumed all test data. | 4626 // Verify that we consumed all test data. |
| 4629 helper.VerifyDataConsumed(); | 4627 helper.VerifyDataConsumed(); |
| 4630 } | 4628 } |
| 4631 | 4629 |
| 4632 // Test that if the server requests persistence of settings, that we save | 4630 // Test that if the server requests persistence of settings, that we save |
| 4633 // the settings in the SpdySettingsStorage. | 4631 // the settings in the HttpServerProperties. |
| 4634 TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { | 4632 TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { |
| 4635 static const SpdyHeaderInfo kSynReplyInfo = { | 4633 static const SpdyHeaderInfo kSynReplyInfo = { |
| 4636 SYN_REPLY, // Syn Reply | 4634 SYN_REPLY, // Syn Reply |
| 4637 1, // Stream ID | 4635 1, // Stream ID |
| 4638 0, // Associated Stream ID | 4636 0, // Associated Stream ID |
| 4639 net::ConvertRequestPriorityToSpdyPriority(LOWEST), // Priority | 4637 net::ConvertRequestPriorityToSpdyPriority(LOWEST), // Priority |
| 4640 0, // Credential Slot | 4638 0, // Credential Slot |
| 4641 CONTROL_FLAG_NONE, // Control Flags | 4639 CONTROL_FLAG_NONE, // Control Flags |
| 4642 false, // Compressed | 4640 false, // Compressed |
| 4643 INVALID, // Status | 4641 INVALID, // Status |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4674 | 4672 |
| 4675 const SpdySettingsIds kSampleId1 = SETTINGS_UPLOAD_BANDWIDTH; | 4673 const SpdySettingsIds kSampleId1 = SETTINGS_UPLOAD_BANDWIDTH; |
| 4676 unsigned int kSampleValue1 = 0x0a0a0a0a; | 4674 unsigned int kSampleValue1 = 0x0a0a0a0a; |
| 4677 const SpdySettingsIds kSampleId2 = SETTINGS_DOWNLOAD_BANDWIDTH; | 4675 const SpdySettingsIds kSampleId2 = SETTINGS_DOWNLOAD_BANDWIDTH; |
| 4678 unsigned int kSampleValue2 = 0x0b0b0b0b; | 4676 unsigned int kSampleValue2 = 0x0b0b0b0b; |
| 4679 const SpdySettingsIds kSampleId3 = SETTINGS_ROUND_TRIP_TIME; | 4677 const SpdySettingsIds kSampleId3 = SETTINGS_ROUND_TRIP_TIME; |
| 4680 unsigned int kSampleValue3 = 0x0c0c0c0c; | 4678 unsigned int kSampleValue3 = 0x0c0c0c0c; |
| 4681 scoped_ptr<SpdyFrame> settings_frame; | 4679 scoped_ptr<SpdyFrame> settings_frame; |
| 4682 { | 4680 { |
| 4683 // Construct the SETTINGS frame. | 4681 // Construct the SETTINGS frame. |
| 4684 SpdySettings settings; | 4682 SettingsMap settings; |
| 4685 // First add a persisted setting. | 4683 // First add a persisted setting. |
| 4686 SettingsFlagsAndId setting1(SETTINGS_FLAG_PLEASE_PERSIST, kSampleId1); | 4684 settings[kSampleId1] = |
| 4687 settings.push_back(std::make_pair(setting1, kSampleValue1)); | 4685 SettingsFlagsAndValue(SETTINGS_FLAG_PLEASE_PERSIST, kSampleValue1); |
| 4688 // Next add a non-persisted setting. | 4686 // Next add a non-persisted setting. |
| 4689 SettingsFlagsAndId setting2(SETTINGS_FLAG_NONE, kSampleId2); | 4687 settings[kSampleId2] = |
| 4690 settings.push_back(std::make_pair(setting2, kSampleValue2)); | 4688 SettingsFlagsAndValue(SETTINGS_FLAG_NONE, kSampleValue2); |
| 4691 // Next add another persisted setting. | 4689 // Next add another persisted setting. |
| 4692 SettingsFlagsAndId setting3(SETTINGS_FLAG_PLEASE_PERSIST, kSampleId3); | 4690 settings[kSampleId3] = |
| 4693 settings.push_back(std::make_pair(setting3, kSampleValue3)); | 4691 SettingsFlagsAndValue(SETTINGS_FLAG_PLEASE_PERSIST, kSampleValue3); |
| 4694 settings_frame.reset(ConstructSpdySettings(settings)); | 4692 settings_frame.reset(ConstructSpdySettings(settings)); |
| 4695 } | 4693 } |
| 4696 | 4694 |
| 4697 scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); | 4695 scoped_ptr<SpdyFrame> body(ConstructSpdyBodyFrame(1, true)); |
| 4698 MockRead reads[] = { | 4696 MockRead reads[] = { |
| 4699 CreateMockRead(*reply), | 4697 CreateMockRead(*reply), |
| 4700 CreateMockRead(*body), | 4698 CreateMockRead(*body), |
| 4701 CreateMockRead(*settings_frame), | 4699 CreateMockRead(*settings_frame), |
| 4702 MockRead(ASYNC, 0, 0) // EOF | 4700 MockRead(ASYNC, 0, 0) // EOF |
| 4703 }; | 4701 }; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4783 spdy_session_pool->http_server_properties()->SetSpdySetting( | 4781 spdy_session_pool->http_server_properties()->SetSpdySetting( |
| 4784 host_port_pair, | 4782 host_port_pair, |
| 4785 kSampleId2, | 4783 kSampleId2, |
| 4786 SETTINGS_FLAG_PLEASE_PERSIST, | 4784 SETTINGS_FLAG_PLEASE_PERSIST, |
| 4787 kSampleValue2); | 4785 kSampleValue2); |
| 4788 | 4786 |
| 4789 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( | 4787 EXPECT_EQ(2u, spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4790 host_port_pair).size()); | 4788 host_port_pair).size()); |
| 4791 | 4789 |
| 4792 // Construct the SETTINGS frame. | 4790 // Construct the SETTINGS frame. |
| 4793 const SettingsMap& settings_map = | 4791 const SettingsMap& settings = |
| 4794 spdy_session_pool->http_server_properties()->GetSpdySettings( | 4792 spdy_session_pool->http_server_properties()->GetSpdySettings( |
| 4795 host_port_pair); | 4793 host_port_pair); |
| 4796 | |
| 4797 SpdySettings settings; | |
| 4798 for (SettingsMap::const_iterator i = settings_map.begin(), | |
| 4799 end = settings_map.end(); i != end; ++i) { | |
| 4800 const SpdySettingsIds id = i->first; | |
| 4801 const SpdySettingsFlags flags = i->second.first; | |
| 4802 const uint32 val = i->second.second; | |
| 4803 SettingsFlagsAndId flags_and_id(flags, id); | |
| 4804 settings.push_back(SpdySetting(flags_and_id, val)); | |
| 4805 } | |
| 4806 | |
| 4807 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); | 4794 scoped_ptr<SpdyFrame> settings_frame(ConstructSpdySettings(settings)); |
| 4808 | 4795 |
| 4809 // Construct the request. | 4796 // Construct the request. |
| 4810 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); | 4797 scoped_ptr<SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST)); |
| 4811 | 4798 |
| 4812 MockWrite writes[] = { | 4799 MockWrite writes[] = { |
| 4813 CreateMockWrite(*settings_frame), | 4800 CreateMockWrite(*settings_frame), |
| 4814 CreateMockWrite(*req), | 4801 CreateMockWrite(*req), |
| 4815 }; | 4802 }; |
| 4816 | 4803 |
| (...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6143 << " Write index: " | 6130 << " Write index: " |
| 6144 << data->write_index(); | 6131 << data->write_index(); |
| 6145 | 6132 |
| 6146 // Verify the SYN_REPLY. | 6133 // Verify the SYN_REPLY. |
| 6147 HttpResponseInfo response = *trans->GetResponseInfo(); | 6134 HttpResponseInfo response = *trans->GetResponseInfo(); |
| 6148 EXPECT_TRUE(response.headers != NULL); | 6135 EXPECT_TRUE(response.headers != NULL); |
| 6149 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 6136 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
| 6150 } | 6137 } |
| 6151 | 6138 |
| 6152 } // namespace net | 6139 } // namespace net |
| OLD | NEW |