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: | 15 public: |
16 FtpCtrlResponseBufferTest() : buffer_(net::BoundNetLog()) { | 16 FtpCtrlResponseBufferTest() : buffer_(net::BoundNetLog()) {} |
17 } | |
18 | 17 |
19 protected: | 18 protected: |
20 int PushDataToBuffer(const char* data) { | 19 int PushDataToBuffer(const char* data) { |
21 return buffer_.ConsumeData(data, strlen(data)); | 20 return buffer_.ConsumeData(data, strlen(data)); |
22 } | 21 } |
23 | 22 |
24 net::FtpCtrlResponseBuffer buffer_; | 23 net::FtpCtrlResponseBuffer buffer_; |
25 }; | 24 }; |
26 | 25 |
27 TEST_F(FtpCtrlResponseBufferTest, Basic) { | 26 TEST_F(FtpCtrlResponseBufferTest, Basic) { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("Non-numeric\r\n")); | 165 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("Non-numeric\r\n")); |
167 EXPECT_FALSE(buffer_.ResponseAvailable()); | 166 EXPECT_FALSE(buffer_.ResponseAvailable()); |
168 } | 167 } |
169 | 168 |
170 TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) { | 169 TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) { |
171 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("777 OK?\r\n")); | 170 EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("777 OK?\r\n")); |
172 EXPECT_FALSE(buffer_.ResponseAvailable()); | 171 EXPECT_FALSE(buffer_.ResponseAvailable()); |
173 } | 172 } |
174 | 173 |
175 } // namespace | 174 } // namespace |
OLD | NEW |