| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ftp/ftp_ctrl_response_buffer.h" | 5 #include "net/ftp/ftp_ctrl_response_buffer.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 class FtpCtrlResponseBufferTest : public testing::Test { | 14 class FtpCtrlResponseBufferTest : public testing::Test { |
| 15 public: |
| 16 FtpCtrlResponseBufferTest() : buffer_(net::BoundNetLog()) { |
| 17 } |
| 18 |
| 15 protected: | 19 protected: |
| 16 int PushDataToBuffer(const char* data) { | 20 int PushDataToBuffer(const char* data) { |
| 17 return buffer_.ConsumeData(data, strlen(data)); | 21 return buffer_.ConsumeData(data, strlen(data)); |
| 18 } | 22 } |
| 19 | 23 |
| 20 net::FtpCtrlResponseBuffer buffer_; | 24 net::FtpCtrlResponseBuffer buffer_; |
| 21 }; | 25 }; |
| 22 | 26 |
| 23 TEST_F(FtpCtrlResponseBufferTest, Basic) { | 27 TEST_F(FtpCtrlResponseBufferTest, Basic) { |
| 24 EXPECT_FALSE(buffer_.ResponseAvailable()); | 28 EXPECT_FALSE(buffer_.ResponseAvailable()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("Non-numeric\r\n")); | 166 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("Non-numeric\r\n")); |
| 163 EXPECT_FALSE(buffer_.ResponseAvailable()); | 167 EXPECT_FALSE(buffer_.ResponseAvailable()); |
| 164 } | 168 } |
| 165 | 169 |
| 166 TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) { | 170 TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) { |
| 167 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("777 OK?\r\n")); | 171 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("777 OK?\r\n")); |
| 168 EXPECT_FALSE(buffer_.ResponseAvailable()); | 172 EXPECT_FALSE(buffer_.ResponseAvailable()); |
| 169 } | 173 } |
| 170 | 174 |
| 171 } // namespace | 175 } // namespace |
| OLD | NEW |