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/balsa/balsa_headers.h" | 5 #include "net/tools/balsa/balsa_headers.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "net/tools/balsa/balsa_enums.h" | 13 #include "net/tools/balsa/balsa_enums.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 using ::base::StringPiece; | 18 using ::base::StringPiece; |
19 | 19 |
20 class BalsaBufferTest : public ::testing::Test { | 20 class BalsaBufferTest : public ::testing::Test { |
21 public: | 21 public: |
22 void SetUp() override { | 22 void SetUp() override { |
23 buffer_.reset(new BalsaBuffer); | 23 buffer_.reset(new BalsaBuffer); |
24 anotherBuffer_.reset(new BalsaBuffer); | 24 anotherBuffer_.reset(new BalsaBuffer); |
25 } | 25 } |
26 | 26 |
27 protected: | 27 protected: |
28 scoped_ptr<BalsaBuffer> buffer_; | 28 std::unique_ptr<BalsaBuffer> buffer_; |
29 scoped_ptr<BalsaBuffer> anotherBuffer_; | 29 std::unique_ptr<BalsaBuffer> anotherBuffer_; |
30 }; | 30 }; |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 class BalsaHeadersTest: public ::testing::Test { | 34 class BalsaHeadersTest: public ::testing::Test { |
35 public: | 35 public: |
36 void SetUp() override { headers_.reset(new BalsaHeaders); } | 36 void SetUp() override { headers_.reset(new BalsaHeaders); } |
37 | 37 |
38 protected: | 38 protected: |
39 scoped_ptr<BalsaHeaders> headers_; | 39 std::unique_ptr<BalsaHeaders> headers_; |
40 }; | 40 }; |
41 | 41 |
42 class StringBuffer { | 42 class StringBuffer { |
43 public: | 43 public: |
44 void Write(const char* p, size_t size) { | 44 void Write(const char* p, size_t size) { |
45 string_ += std::string(p, size); | 45 string_ += std::string(p, size); |
46 } | 46 } |
47 const std::string& string() {return string_;} | 47 const std::string& string() {return string_;} |
48 | 48 |
49 private: | 49 private: |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 ASSERT_EQ("HTTP/1.0 403 FORBIDDEN", headers_->first_line()); | 382 ASSERT_EQ("HTTP/1.0 403 FORBIDDEN", headers_->first_line()); |
383 ASSERT_EQ("HTTP/1.0", headers_->response_version()); | 383 ASSERT_EQ("HTTP/1.0", headers_->response_version()); |
384 ASSERT_EQ("403", headers_->response_code()); | 384 ASSERT_EQ("403", headers_->response_code()); |
385 ASSERT_EQ("FORBIDDEN", headers_->response_reason_phrase()); | 385 ASSERT_EQ("FORBIDDEN", headers_->response_reason_phrase()); |
386 } | 386 } |
387 | 387 |
388 } // namespace | 388 } // namespace |
389 | 389 |
390 } // namespace net | 390 } // namespace net |
OLD | NEW |