OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tools/flip_server/spdy_interface.h" | 5 #include "net/tools/flip_server/spdy_interface.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 MOCK_METHOD4(OnStreamFrameData, void(SpdyStreamId, | 69 MOCK_METHOD4(OnStreamFrameData, void(SpdyStreamId, |
70 const char*, | 70 const char*, |
71 size_t, | 71 size_t, |
72 bool)); | 72 bool)); |
73 MOCK_METHOD2(OnStreamPadding, void(SpdyStreamId, size_t)); | 73 MOCK_METHOD2(OnStreamPadding, void(SpdyStreamId, size_t)); |
74 MOCK_METHOD1(OnHeaderFrameStart, | 74 MOCK_METHOD1(OnHeaderFrameStart, |
75 SpdyHeadersHandlerInterface*(SpdyStreamId stream_id)); | 75 SpdyHeadersHandlerInterface*(SpdyStreamId stream_id)); |
76 MOCK_METHOD2(OnHeaderFrameEnd, | 76 MOCK_METHOD2(OnHeaderFrameEnd, |
77 void(SpdyStreamId stream_id, bool end_headers)); | 77 void(SpdyStreamId stream_id, bool end_headers)); |
78 MOCK_METHOD1(OnSettings, void(bool clear_persisted)); | 78 MOCK_METHOD1(OnSettings, void(bool clear_persisted)); |
79 MOCK_METHOD3(OnSetting, void(SpdySettingsIds, uint8, uint32)); | 79 MOCK_METHOD3(OnSetting, void(SpdySettingsIds, uint8_t, uint32_t)); |
80 MOCK_METHOD2(OnPing, void(SpdyPingId unique_id, bool is_ack)); | 80 MOCK_METHOD2(OnPing, void(SpdyPingId unique_id, bool is_ack)); |
81 MOCK_METHOD2(OnRstStream, void(SpdyStreamId, SpdyRstStreamStatus)); | 81 MOCK_METHOD2(OnRstStream, void(SpdyStreamId, SpdyRstStreamStatus)); |
82 MOCK_METHOD3(OnGoAway, void(SpdyStreamId, SpdyGoAwayStatus, StringPiece)); | 82 MOCK_METHOD3(OnGoAway, void(SpdyStreamId, SpdyGoAwayStatus, StringPiece)); |
83 MOCK_METHOD2(OnWindowUpdate, void(SpdyStreamId, int)); | 83 MOCK_METHOD2(OnWindowUpdate, void(SpdyStreamId, int)); |
84 MOCK_METHOD3(OnPushPromise, | 84 MOCK_METHOD3(OnPushPromise, |
85 void(SpdyStreamId, SpdyStreamId, const SpdyHeaderBlock&)); | 85 void(SpdyStreamId, SpdyStreamId, const SpdyHeaderBlock&)); |
86 MOCK_METHOD2(OnUnknownFrame, bool(SpdyStreamId stream_id, int frame_type)); | 86 MOCK_METHOD2(OnUnknownFrame, bool(SpdyStreamId stream_id, int frame_type)); |
87 }; | 87 }; |
88 | 88 |
89 class FakeSMConnection : public SMConnection { | 89 class FakeSMConnection : public SMConnection { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 OutputList& output_list = *connection_->output_list(); | 183 OutputList& output_list = *connection_->output_list(); |
184 for (OutputList::const_iterator i = output_list.begin(); | 184 for (OutputList::const_iterator i = output_list.begin(); |
185 i != output_list.end(); | 185 i != output_list.end(); |
186 ++i) { | 186 ++i) { |
187 delete *i; | 187 delete *i; |
188 } | 188 } |
189 output_list.clear(); | 189 output_list.clear(); |
190 } | 190 } |
191 | 191 |
192 bool HasStream(uint32 stream_id) { | 192 bool HasStream(uint32_t stream_id) { |
193 return interface_->output_ordering().ExistsInPriorityMaps(stream_id); | 193 return interface_->output_ordering().ExistsInPriorityMaps(stream_id); |
194 } | 194 } |
195 | 195 |
196 protected: | 196 protected: |
197 scoped_ptr<MockSMInterface> mock_another_interface_; | 197 scoped_ptr<MockSMInterface> mock_another_interface_; |
198 scoped_ptr<MemoryCache> memory_cache_; | 198 scoped_ptr<MemoryCache> memory_cache_; |
199 scoped_ptr<FlipAcceptor> acceptor_; | 199 scoped_ptr<FlipAcceptor> acceptor_; |
200 scoped_ptr<EpollServer> epoll_server_; | 200 scoped_ptr<EpollServer> epoll_server_; |
201 scoped_ptr<FakeSMConnection> connection_; | 201 scoped_ptr<FakeSMConnection> connection_; |
202 scoped_ptr<TestSpdySM> interface_; | 202 scoped_ptr<TestSpdySM> interface_; |
(...skipping 21 matching lines...) Expand all Loading... |
224 InSequence s; | 224 InSequence s; |
225 EXPECT_CALL(*connection_, InitSMConnection(_, _, _, _, _, _, _, _)); | 225 EXPECT_CALL(*connection_, InitSMConnection(_, _, _, _, _, _, _, _)); |
226 } | 226 } |
227 interface_->InitSMConnection( | 227 interface_->InitSMConnection( |
228 NULL, NULL, epoll_server_.get(), -1, "", "", "", false); | 228 NULL, NULL, epoll_server_.get(), -1, "", "", "", false); |
229 } | 229 } |
230 | 230 |
231 TEST_P(SpdySMProxyTest, OnStreamFrameData) { | 231 TEST_P(SpdySMProxyTest, OnStreamFrameData) { |
232 BufferedSpdyFramerVisitorInterface* visitor = interface_.get(); | 232 BufferedSpdyFramerVisitorInterface* visitor = interface_.get(); |
233 scoped_ptr<MockSMInterface> mock_interface(new MockSMInterface); | 233 scoped_ptr<MockSMInterface> mock_interface(new MockSMInterface); |
234 uint32 stream_id = 92; | 234 uint32_t stream_id = 92; |
235 uint32 associated_id = 43; | 235 uint32_t associated_id = 43; |
236 SpdyHeaderBlock block; | 236 SpdyHeaderBlock block; |
237 testing::MockFunction<void(int)> checkpoint; // NOLINT | 237 testing::MockFunction<void(int)> checkpoint; // NOLINT |
238 | 238 |
239 scoped_ptr<SpdyFrame> frame(spdy_framer_->CreatePingFrame(12, false)); | 239 scoped_ptr<SpdyFrame> frame(spdy_framer_->CreatePingFrame(12, false)); |
240 block[":method"] = "GET"; | 240 block[":method"] = "GET"; |
241 block[":host"] = "www.example.com"; | 241 block[":host"] = "www.example.com"; |
242 block[":path"] = "/path"; | 242 block[":path"] = "/path"; |
243 block[":scheme"] = "http"; | 243 block[":scheme"] = "http"; |
244 block["foo"] = "bar"; | 244 block["foo"] = "bar"; |
245 { | 245 { |
246 InSequence s; | 246 InSequence s; |
247 EXPECT_CALL(*interface_, | 247 EXPECT_CALL(*interface_, |
248 FindOrMakeNewSMConnectionInterface(_, _)) | 248 FindOrMakeNewSMConnectionInterface(_, _)) |
249 .WillOnce(Return(mock_interface.get())); | 249 .WillOnce(Return(mock_interface.get())); |
250 EXPECT_CALL(*mock_interface, SetStreamID(stream_id)); | 250 EXPECT_CALL(*mock_interface, SetStreamID(stream_id)); |
251 EXPECT_CALL(*mock_interface, ProcessWriteInput(_, _)).Times(1); | 251 EXPECT_CALL(*mock_interface, ProcessWriteInput(_, _)).Times(1); |
252 EXPECT_CALL(checkpoint, Call(0)); | 252 EXPECT_CALL(checkpoint, Call(0)); |
253 EXPECT_CALL(*mock_interface, | 253 EXPECT_CALL(*mock_interface, |
254 ProcessWriteInput(frame->data(), frame->size())).Times(1); | 254 ProcessWriteInput(frame->data(), frame->size())).Times(1); |
255 } | 255 } |
256 | 256 |
257 visitor->OnSynStream(stream_id, associated_id, 0, false, false, block); | 257 visitor->OnSynStream(stream_id, associated_id, 0, false, false, block); |
258 checkpoint.Call(0); | 258 checkpoint.Call(0); |
259 visitor->OnStreamFrameData(stream_id, frame->data(), frame->size(), true); | 259 visitor->OnStreamFrameData(stream_id, frame->data(), frame->size(), true); |
260 } | 260 } |
261 | 261 |
262 TEST_P(SpdySMProxyTest, OnRstStream) { | 262 TEST_P(SpdySMProxyTest, OnRstStream) { |
263 BufferedSpdyFramerVisitorInterface* visitor = interface_.get(); | 263 BufferedSpdyFramerVisitorInterface* visitor = interface_.get(); |
264 uint32 stream_id = 82; | 264 uint32_t stream_id = 82; |
265 MemCacheIter mci; | 265 MemCacheIter mci; |
266 mci.stream_id = stream_id; | 266 mci.stream_id = stream_id; |
267 | 267 |
268 { | 268 { |
269 BalsaHeaders headers; | 269 BalsaHeaders headers; |
270 std::string filename = "foobar"; | 270 std::string filename = "foobar"; |
271 memory_cache_->InsertFile(&headers, filename, ""); | 271 memory_cache_->InsertFile(&headers, filename, ""); |
272 mci.file_data = memory_cache_->GetFileData(filename); | 272 mci.file_data = memory_cache_->GetFileData(filename); |
273 } | 273 } |
274 | 274 |
275 interface_->AddToOutputOrder(mci); | 275 interface_->AddToOutputOrder(mci); |
276 ASSERT_TRUE(HasStream(stream_id)); | 276 ASSERT_TRUE(HasStream(stream_id)); |
277 visitor->OnRstStream(stream_id, RST_STREAM_INVALID); | 277 visitor->OnRstStream(stream_id, RST_STREAM_INVALID); |
278 ASSERT_FALSE(HasStream(stream_id)); | 278 ASSERT_FALSE(HasStream(stream_id)); |
279 } | 279 } |
280 | 280 |
281 TEST_P(SpdySMProxyTest, ProcessReadInput) { | 281 TEST_P(SpdySMProxyTest, ProcessReadInput) { |
282 ASSERT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, | 282 ASSERT_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, |
283 interface_->spdy_framer()->state()); | 283 interface_->spdy_framer()->state()); |
284 interface_->ProcessReadInput("", 1); | 284 interface_->ProcessReadInput("", 1); |
285 ASSERT_EQ(SpdyFramer::SPDY_READING_COMMON_HEADER, | 285 ASSERT_EQ(SpdyFramer::SPDY_READING_COMMON_HEADER, |
286 interface_->spdy_framer()->state()); | 286 interface_->spdy_framer()->state()); |
287 } | 287 } |
288 | 288 |
289 TEST_P(SpdySMProxyTest, ResetForNewConnection) { | 289 TEST_P(SpdySMProxyTest, ResetForNewConnection) { |
290 uint32 stream_id = 13; | 290 uint32_t stream_id = 13; |
291 MemCacheIter mci; | 291 MemCacheIter mci; |
292 mci.stream_id = stream_id; | 292 mci.stream_id = stream_id; |
293 // incomplete input | 293 // incomplete input |
294 const char input[] = {'\0', '\0', '\0'}; | 294 const char input[] = {'\0', '\0', '\0'}; |
295 | 295 |
296 { | 296 { |
297 BalsaHeaders headers; | 297 BalsaHeaders headers; |
298 std::string filename = "foobar"; | 298 std::string filename = "foobar"; |
299 memory_cache_->InsertFile(&headers, filename, ""); | 299 memory_cache_->InsertFile(&headers, filename, ""); |
300 mci.file_data = memory_cache_->GetFileData(filename); | 300 mci.file_data = memory_cache_->GetFileData(filename); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 spdy_framer_->ProcessInput(df->data, df->size); | 339 spdy_framer_->ProcessInput(df->data, df->size); |
340 } | 340 } |
341 | 341 |
342 TEST_P(SpdySMProxyTest, NewStream) { | 342 TEST_P(SpdySMProxyTest, NewStream) { |
343 // TODO(yhirano): SpdySM::NewStream leads to crash when | 343 // TODO(yhirano): SpdySM::NewStream leads to crash when |
344 // acceptor_->flip_handler_type_ != FLIP_HANDLER_SPDY_SERVER. | 344 // acceptor_->flip_handler_type_ != FLIP_HANDLER_SPDY_SERVER. |
345 // It should be fixed though I don't know the solution now. | 345 // It should be fixed though I don't know the solution now. |
346 } | 346 } |
347 | 347 |
348 TEST_P(SpdySMProxyTest, AddToOutputOrder) { | 348 TEST_P(SpdySMProxyTest, AddToOutputOrder) { |
349 uint32 stream_id = 13; | 349 uint32_t stream_id = 13; |
350 MemCacheIter mci; | 350 MemCacheIter mci; |
351 mci.stream_id = stream_id; | 351 mci.stream_id = stream_id; |
352 | 352 |
353 { | 353 { |
354 BalsaHeaders headers; | 354 BalsaHeaders headers; |
355 std::string filename = "foobar"; | 355 std::string filename = "foobar"; |
356 memory_cache_->InsertFile(&headers, filename, ""); | 356 memory_cache_->InsertFile(&headers, filename, ""); |
357 mci.file_data = memory_cache_->GetFileData(filename); | 357 mci.file_data = memory_cache_->GetFileData(filename); |
358 } | 358 } |
359 | 359 |
360 interface_->AddToOutputOrder(mci); | 360 interface_->AddToOutputOrder(mci); |
361 ASSERT_TRUE(HasStream(stream_id)); | 361 ASSERT_TRUE(HasStream(stream_id)); |
362 } | 362 } |
363 | 363 |
364 TEST_P(SpdySMProxyTest, SendErrorNotFound) { | 364 TEST_P(SpdySMProxyTest, SendErrorNotFound) { |
365 uint32 stream_id = 82; | 365 uint32_t stream_id = 82; |
366 SpdyHeaderBlock actual_header_block; | 366 SpdyHeaderBlock actual_header_block; |
367 const char* actual_data; | 367 const char* actual_data; |
368 size_t actual_size; | 368 size_t actual_size; |
369 testing::MockFunction<void(int)> checkpoint; // NOLINT | 369 testing::MockFunction<void(int)> checkpoint; // NOLINT |
370 | 370 |
371 interface_->SendErrorNotFound(stream_id); | 371 interface_->SendErrorNotFound(stream_id); |
372 | 372 |
373 ASSERT_EQ(2u, connection_->output_list()->size()); | 373 ASSERT_EQ(2u, connection_->output_list()->size()); |
374 | 374 |
375 { | 375 { |
(...skipping 27 matching lines...) Expand all Loading... |
403 spdy_framer_->ProcessInput(df->data, df->size); | 403 spdy_framer_->ProcessInput(df->data, df->size); |
404 | 404 |
405 ASSERT_EQ(2, spdy_framer_->frames_received()); | 405 ASSERT_EQ(2, spdy_framer_->frames_received()); |
406 ASSERT_EQ(2u, actual_header_block.size()); | 406 ASSERT_EQ(2u, actual_header_block.size()); |
407 ASSERT_EQ("404 Not Found", actual_header_block[":status"]); | 407 ASSERT_EQ("404 Not Found", actual_header_block[":status"]); |
408 ASSERT_EQ("HTTP/1.1", actual_header_block[":version"]); | 408 ASSERT_EQ("HTTP/1.1", actual_header_block[":version"]); |
409 ASSERT_EQ("wtf?", StringPiece(actual_data, actual_size)); | 409 ASSERT_EQ("wtf?", StringPiece(actual_data, actual_size)); |
410 } | 410 } |
411 | 411 |
412 TEST_P(SpdySMProxyTest, SendSynStream) { | 412 TEST_P(SpdySMProxyTest, SendSynStream) { |
413 uint32 stream_id = 82; | 413 uint32_t stream_id = 82; |
414 BalsaHeaders headers; | 414 BalsaHeaders headers; |
415 SpdyHeaderBlock actual_header_block; | 415 SpdyHeaderBlock actual_header_block; |
416 headers.AppendHeader("key1", "value1"); | 416 headers.AppendHeader("key1", "value1"); |
417 headers.AppendHeader("Host", "www.example.com"); | 417 headers.AppendHeader("Host", "www.example.com"); |
418 headers.SetRequestFirstlineFromStringPieces("GET", "/path", "HTTP/1.1"); | 418 headers.SetRequestFirstlineFromStringPieces("GET", "/path", "HTTP/1.1"); |
419 | 419 |
420 interface_->SendSynStream(stream_id, headers); | 420 interface_->SendSynStream(stream_id, headers); |
421 | 421 |
422 ASSERT_EQ(1u, connection_->output_list()->size()); | 422 ASSERT_EQ(1u, connection_->output_list()->size()); |
423 std::list<DataFrame*>::const_iterator i = connection_->output_list()->begin(); | 423 std::list<DataFrame*>::const_iterator i = connection_->output_list()->begin(); |
(...skipping 10 matching lines...) Expand all Loading... |
434 ASSERT_EQ(1, spdy_framer_->frames_received()); | 434 ASSERT_EQ(1, spdy_framer_->frames_received()); |
435 ASSERT_EQ(5u, actual_header_block.size()); | 435 ASSERT_EQ(5u, actual_header_block.size()); |
436 ASSERT_EQ("GET", actual_header_block[":method"]); | 436 ASSERT_EQ("GET", actual_header_block[":method"]); |
437 ASSERT_EQ("HTTP/1.1", actual_header_block[":version"]); | 437 ASSERT_EQ("HTTP/1.1", actual_header_block[":version"]); |
438 ASSERT_EQ("/path", actual_header_block[":path"]); | 438 ASSERT_EQ("/path", actual_header_block[":path"]); |
439 ASSERT_EQ("www.example.com", actual_header_block[":host"]); | 439 ASSERT_EQ("www.example.com", actual_header_block[":host"]); |
440 ASSERT_EQ("value1", actual_header_block["key1"]); | 440 ASSERT_EQ("value1", actual_header_block["key1"]); |
441 } | 441 } |
442 | 442 |
443 TEST_P(SpdySMProxyTest, SendSynReply) { | 443 TEST_P(SpdySMProxyTest, SendSynReply) { |
444 uint32 stream_id = 82; | 444 uint32_t stream_id = 82; |
445 BalsaHeaders headers; | 445 BalsaHeaders headers; |
446 SpdyHeaderBlock actual_header_block; | 446 SpdyHeaderBlock actual_header_block; |
447 headers.AppendHeader("key1", "value1"); | 447 headers.AppendHeader("key1", "value1"); |
448 headers.SetResponseFirstlineFromStringPieces("HTTP/1.1", "200", "OK"); | 448 headers.SetResponseFirstlineFromStringPieces("HTTP/1.1", "200", "OK"); |
449 | 449 |
450 interface_->SendSynReply(stream_id, headers); | 450 interface_->SendSynReply(stream_id, headers); |
451 | 451 |
452 ASSERT_EQ(1u, connection_->output_list()->size()); | 452 ASSERT_EQ(1u, connection_->output_list()->size()); |
453 std::list<DataFrame*>::const_iterator i = connection_->output_list()->begin(); | 453 std::list<DataFrame*>::const_iterator i = connection_->output_list()->begin(); |
454 DataFrame* df = *i++; | 454 DataFrame* df = *i++; |
(...skipping 13 matching lines...) Expand all Loading... |
468 | 468 |
469 spdy_framer_->ProcessInput(df->data, df->size); | 469 spdy_framer_->ProcessInput(df->data, df->size); |
470 ASSERT_EQ(1, spdy_framer_->frames_received()); | 470 ASSERT_EQ(1, spdy_framer_->frames_received()); |
471 ASSERT_EQ(3u, actual_header_block.size()); | 471 ASSERT_EQ(3u, actual_header_block.size()); |
472 ASSERT_EQ("200 OK", actual_header_block[":status"]); | 472 ASSERT_EQ("200 OK", actual_header_block[":status"]); |
473 ASSERT_EQ("HTTP/1.1", actual_header_block[":version"]); | 473 ASSERT_EQ("HTTP/1.1", actual_header_block[":version"]); |
474 ASSERT_EQ("value1", actual_header_block["key1"]); | 474 ASSERT_EQ("value1", actual_header_block["key1"]); |
475 } | 475 } |
476 | 476 |
477 TEST_P(SpdySMProxyTest, SendDataFrame) { | 477 TEST_P(SpdySMProxyTest, SendDataFrame) { |
478 uint32 stream_id = 133; | 478 uint32_t stream_id = 133; |
479 SpdyDataFlags flags = DATA_FLAG_NONE; | 479 SpdyDataFlags flags = DATA_FLAG_NONE; |
480 const char* actual_data; | 480 const char* actual_data; |
481 size_t actual_size; | 481 size_t actual_size; |
482 | 482 |
483 interface_->SendDataFrame(stream_id, "hello", 5, flags, true); | 483 interface_->SendDataFrame(stream_id, "hello", 5, flags, true); |
484 | 484 |
485 ASSERT_EQ(1u, connection_->output_list()->size()); | 485 ASSERT_EQ(1u, connection_->output_list()->size()); |
486 std::list<DataFrame*>::const_iterator i = connection_->output_list()->begin(); | 486 std::list<DataFrame*>::const_iterator i = connection_->output_list()->begin(); |
487 DataFrame* df = *i++; | 487 DataFrame* df = *i++; |
488 | 488 |
489 { | 489 { |
490 InSequence s; | 490 InSequence s; |
491 EXPECT_CALL(*spdy_framer_visitor_, | 491 EXPECT_CALL(*spdy_framer_visitor_, |
492 OnDataFrameHeader(stream_id, _, false)); | 492 OnDataFrameHeader(stream_id, _, false)); |
493 EXPECT_CALL(*spdy_framer_visitor_, | 493 EXPECT_CALL(*spdy_framer_visitor_, |
494 OnStreamFrameData(stream_id, _, _, false)) | 494 OnStreamFrameData(stream_id, _, _, false)) |
495 .WillOnce(DoAll(SaveArg<1>(&actual_data), SaveArg<2>(&actual_size))); | 495 .WillOnce(DoAll(SaveArg<1>(&actual_data), SaveArg<2>(&actual_size))); |
496 } | 496 } |
497 | 497 |
498 spdy_framer_->ProcessInput(df->data, df->size); | 498 spdy_framer_->ProcessInput(df->data, df->size); |
499 ASSERT_EQ(1, spdy_framer_->frames_received()); | 499 ASSERT_EQ(1, spdy_framer_->frames_received()); |
500 ASSERT_EQ("hello", StringPiece(actual_data, actual_size)); | 500 ASSERT_EQ("hello", StringPiece(actual_data, actual_size)); |
501 } | 501 } |
502 | 502 |
503 TEST_P(SpdySMProxyTest, SendLongDataFrame) { | 503 TEST_P(SpdySMProxyTest, SendLongDataFrame) { |
504 uint32 stream_id = 133; | 504 uint32_t stream_id = 133; |
505 SpdyDataFlags flags = DATA_FLAG_NONE; | 505 SpdyDataFlags flags = DATA_FLAG_NONE; |
506 const char* actual_data; | 506 const char* actual_data; |
507 size_t actual_size; | 507 size_t actual_size; |
508 | 508 |
509 std::string data = std::string(kSpdySegmentSize, 'a') + | 509 std::string data = std::string(kSpdySegmentSize, 'a') + |
510 std::string(kSpdySegmentSize, 'b') + "c"; | 510 std::string(kSpdySegmentSize, 'b') + "c"; |
511 interface_->SendDataFrame(stream_id, data.data(), data.size(), flags, true); | 511 interface_->SendDataFrame(stream_id, data.data(), data.size(), flags, true); |
512 | 512 |
513 { | 513 { |
514 InSequence s; | 514 InSequence s; |
(...skipping 19 matching lines...) Expand all Loading... |
534 ASSERT_EQ(std::string(kSpdySegmentSize, 'b'), | 534 ASSERT_EQ(std::string(kSpdySegmentSize, 'b'), |
535 StringPiece(actual_data, actual_size)); | 535 StringPiece(actual_data, actual_size)); |
536 | 536 |
537 df = *i++; | 537 df = *i++; |
538 spdy_framer_->ProcessInput(df->data, df->size); | 538 spdy_framer_->ProcessInput(df->data, df->size); |
539 ASSERT_EQ("c", StringPiece(actual_data, actual_size)); | 539 ASSERT_EQ("c", StringPiece(actual_data, actual_size)); |
540 } | 540 } |
541 | 541 |
542 TEST_P(SpdySMServerTest, OnSynStream) { | 542 TEST_P(SpdySMServerTest, OnSynStream) { |
543 BufferedSpdyFramerVisitorInterface* visitor = interface_.get(); | 543 BufferedSpdyFramerVisitorInterface* visitor = interface_.get(); |
544 uint32 stream_id = 82; | 544 uint32_t stream_id = 82; |
545 SpdyHeaderBlock spdy_headers; | 545 SpdyHeaderBlock spdy_headers; |
546 spdy_headers["url"] = "http://www.example.com/path"; | 546 spdy_headers["url"] = "http://www.example.com/path"; |
547 spdy_headers["method"] = "GET"; | 547 spdy_headers["method"] = "GET"; |
548 spdy_headers["scheme"] = "http"; | 548 spdy_headers["scheme"] = "http"; |
549 spdy_headers["version"] = "HTTP/1.1"; | 549 spdy_headers["version"] = "HTTP/1.1"; |
550 | 550 |
551 { | 551 { |
552 BalsaHeaders headers; | 552 BalsaHeaders headers; |
553 memory_cache_->InsertFile(&headers, "GET_/path", ""); | 553 memory_cache_->InsertFile(&headers, "GET_/path", ""); |
554 } | 554 } |
555 visitor->OnSynStream(stream_id, 0, 0, true, true, spdy_headers); | 555 visitor->OnSynStream(stream_id, 0, 0, true, true, spdy_headers); |
556 ASSERT_TRUE(HasStream(stream_id)); | 556 ASSERT_TRUE(HasStream(stream_id)); |
557 } | 557 } |
558 | 558 |
559 TEST_P(SpdySMServerTest, NewStream) { | 559 TEST_P(SpdySMServerTest, NewStream) { |
560 uint32 stream_id = 13; | 560 uint32_t stream_id = 13; |
561 std::string filename = "foobar"; | 561 std::string filename = "foobar"; |
562 | 562 |
563 { | 563 { |
564 BalsaHeaders headers; | 564 BalsaHeaders headers; |
565 memory_cache_->InsertFile(&headers, filename, ""); | 565 memory_cache_->InsertFile(&headers, filename, ""); |
566 } | 566 } |
567 | 567 |
568 interface_->NewStream(stream_id, 0, filename); | 568 interface_->NewStream(stream_id, 0, filename); |
569 ASSERT_TRUE(HasStream(stream_id)); | 569 ASSERT_TRUE(HasStream(stream_id)); |
570 } | 570 } |
571 | 571 |
572 TEST_P(SpdySMServerTest, NewStreamError) { | 572 TEST_P(SpdySMServerTest, NewStreamError) { |
573 uint32 stream_id = 82; | 573 uint32_t stream_id = 82; |
574 SpdyHeaderBlock actual_header_block; | 574 SpdyHeaderBlock actual_header_block; |
575 const char* actual_data; | 575 const char* actual_data; |
576 size_t actual_size; | 576 size_t actual_size; |
577 testing::MockFunction<void(int)> checkpoint; // NOLINT | 577 testing::MockFunction<void(int)> checkpoint; // NOLINT |
578 | 578 |
579 interface_->NewStream(stream_id, 0, "nonexistingfile"); | 579 interface_->NewStream(stream_id, 0, "nonexistingfile"); |
580 | 580 |
581 ASSERT_EQ(2u, connection_->output_list()->size()); | 581 ASSERT_EQ(2u, connection_->output_list()->size()); |
582 | 582 |
583 { | 583 { |
(...skipping 28 matching lines...) Expand all Loading... |
612 ASSERT_EQ(2, spdy_framer_->frames_received()); | 612 ASSERT_EQ(2, spdy_framer_->frames_received()); |
613 ASSERT_EQ(2u, actual_header_block.size()); | 613 ASSERT_EQ(2u, actual_header_block.size()); |
614 ASSERT_EQ("404 Not Found", actual_header_block["status"]); | 614 ASSERT_EQ("404 Not Found", actual_header_block["status"]); |
615 ASSERT_EQ("HTTP/1.1", actual_header_block["version"]); | 615 ASSERT_EQ("HTTP/1.1", actual_header_block["version"]); |
616 ASSERT_EQ("wtf?", StringPiece(actual_data, actual_size)); | 616 ASSERT_EQ("wtf?", StringPiece(actual_data, actual_size)); |
617 } | 617 } |
618 | 618 |
619 } // namespace | 619 } // namespace |
620 | 620 |
621 } // namespace net | 621 } // namespace net |
OLD | NEW |