| 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/server/http_server.h" | 5 #include "net/server/http_server.h" | 
| 6 | 6 | 
| 7 #include <stdint.h> | 7 #include <stdint.h> | 
| 8 | 8 | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 #include <memory> | 10 #include <memory> | 
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 536     } | 536     } | 
| 537   } | 537   } | 
| 538   bool IsConnected() const override { return connected_; } | 538   bool IsConnected() const override { return connected_; } | 
| 539   bool IsConnectedAndIdle() const override { return IsConnected(); } | 539   bool IsConnectedAndIdle() const override { return IsConnected(); } | 
| 540   int GetPeerAddress(IPEndPoint* address) const override { | 540   int GetPeerAddress(IPEndPoint* address) const override { | 
| 541     return ERR_NOT_IMPLEMENTED; | 541     return ERR_NOT_IMPLEMENTED; | 
| 542   } | 542   } | 
| 543   int GetLocalAddress(IPEndPoint* address) const override { | 543   int GetLocalAddress(IPEndPoint* address) const override { | 
| 544     return ERR_NOT_IMPLEMENTED; | 544     return ERR_NOT_IMPLEMENTED; | 
| 545   } | 545   } | 
| 546   const BoundNetLog& NetLog() const override { return net_log_; } | 546   const NetLogWithSource& NetLog() const override { return net_log_; } | 
| 547   void SetSubresourceSpeculation() override {} | 547   void SetSubresourceSpeculation() override {} | 
| 548   void SetOmniboxSpeculation() override {} | 548   void SetOmniboxSpeculation() override {} | 
| 549   bool WasEverUsed() const override { return true; } | 549   bool WasEverUsed() const override { return true; } | 
| 550   bool WasNpnNegotiated() const override { return false; } | 550   bool WasNpnNegotiated() const override { return false; } | 
| 551   NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } | 551   NextProto GetNegotiatedProtocol() const override { return kProtoUnknown; } | 
| 552   bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } | 552   bool GetSSLInfo(SSLInfo* ssl_info) override { return false; } | 
| 553   void GetConnectionAttempts(ConnectionAttempts* out) const override { | 553   void GetConnectionAttempts(ConnectionAttempts* out) const override { | 
| 554     out->clear(); | 554     out->clear(); | 
| 555   } | 555   } | 
| 556   void ClearConnectionAttempts() override {} | 556   void ClearConnectionAttempts() override {} | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 604   } | 604   } | 
| 605 | 605 | 
| 606  private: | 606  private: | 
| 607   ~MockStreamSocket() override {} | 607   ~MockStreamSocket() override {} | 
| 608 | 608 | 
| 609   bool connected_; | 609   bool connected_; | 
| 610   scoped_refptr<IOBuffer> read_buf_; | 610   scoped_refptr<IOBuffer> read_buf_; | 
| 611   int read_buf_len_; | 611   int read_buf_len_; | 
| 612   CompletionCallback read_callback_; | 612   CompletionCallback read_callback_; | 
| 613   std::string pending_read_data_; | 613   std::string pending_read_data_; | 
| 614   BoundNetLog net_log_; | 614   NetLogWithSource net_log_; | 
| 615 | 615 | 
| 616   DISALLOW_COPY_AND_ASSIGN(MockStreamSocket); | 616   DISALLOW_COPY_AND_ASSIGN(MockStreamSocket); | 
| 617 }; | 617 }; | 
| 618 | 618 | 
| 619 TEST_F(HttpServerTest, RequestWithBodySplitAcrossPackets) { | 619 TEST_F(HttpServerTest, RequestWithBodySplitAcrossPackets) { | 
| 620   MockStreamSocket* socket = new MockStreamSocket(); | 620   MockStreamSocket* socket = new MockStreamSocket(); | 
| 621   HandleAcceptResult(base::WrapUnique<StreamSocket>(socket)); | 621   HandleAcceptResult(base::WrapUnique<StreamSocket>(socket)); | 
| 622   std::string body("body"); | 622   std::string body("body"); | 
| 623   std::string request_text = base::StringPrintf( | 623   std::string request_text = base::StringPrintf( | 
| 624       "GET /test HTTP/1.1\r\n" | 624       "GET /test HTTP/1.1\r\n" | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 698   ASSERT_THAT(client.ConnectAndWait(server_address_), IsOk()); | 698   ASSERT_THAT(client.ConnectAndWait(server_address_), IsOk()); | 
| 699   client.Send("GET / HTTP/1.1\r\n\r\n"); | 699   client.Send("GET / HTTP/1.1\r\n\r\n"); | 
| 700   ASSERT_FALSE(RunUntilRequestsReceived(1)); | 700   ASSERT_FALSE(RunUntilRequestsReceived(1)); | 
| 701   ASSERT_EQ(1ul, connection_ids_.size()); | 701   ASSERT_EQ(1ul, connection_ids_.size()); | 
| 702   ASSERT_EQ(0ul, requests_.size()); | 702   ASSERT_EQ(0ul, requests_.size()); | 
| 703 } | 703 } | 
| 704 | 704 | 
| 705 }  // namespace | 705 }  // namespace | 
| 706 | 706 | 
| 707 }  // namespace net | 707 }  // namespace net | 
| OLD | NEW | 
|---|