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 "net/test/gtest_util.h" | 10 #include "net/test/gtest_util.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using net::test::IsError; | 14 using net::test::IsError; |
15 using net::test::IsOk; | 15 using net::test::IsOk; |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 class FtpCtrlResponseBufferTest : public testing::Test { | 21 class FtpCtrlResponseBufferTest : public testing::Test { |
22 public: | 22 public: |
23 FtpCtrlResponseBufferTest() : buffer_(BoundNetLog()) {} | 23 FtpCtrlResponseBufferTest() : buffer_(NetLogWithSource()) {} |
24 | 24 |
25 protected: | 25 protected: |
26 int PushDataToBuffer(const char* data) { | 26 int PushDataToBuffer(const char* data) { |
27 return buffer_.ConsumeData(data, strlen(data)); | 27 return buffer_.ConsumeData(data, strlen(data)); |
28 } | 28 } |
29 | 29 |
30 FtpCtrlResponseBuffer buffer_; | 30 FtpCtrlResponseBuffer buffer_; |
31 }; | 31 }; |
32 | 32 |
33 TEST_F(FtpCtrlResponseBufferTest, Basic) { | 33 TEST_F(FtpCtrlResponseBufferTest, Basic) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) { | 177 TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) { |
178 EXPECT_THAT(PushDataToBuffer("777 OK?\r\n"), IsError(ERR_INVALID_RESPONSE)); | 178 EXPECT_THAT(PushDataToBuffer("777 OK?\r\n"), IsError(ERR_INVALID_RESPONSE)); |
179 EXPECT_FALSE(buffer_.ResponseAvailable()); | 179 EXPECT_FALSE(buffer_.ResponseAvailable()); |
180 } | 180 } |
181 | 181 |
182 } // namespace | 182 } // namespace |
183 | 183 |
184 } // namespace net | 184 } // namespace net |
OLD | NEW |