Chromium Code Reviews| Index: util/net/http_body_test.cc |
| diff --git a/util/net/http_body_test.cc b/util/net/http_body_test.cc |
| index c59b6d6bf38a1c35eff94359323582b5162000bb..966d05cc1611af57c05cc24062cce579727dc74f 100644 |
| --- a/util/net/http_body_test.cc |
| +++ b/util/net/http_body_test.cc |
| @@ -96,7 +96,8 @@ TEST(StringHTTPBodyStream, MultipleReads) { |
| TEST(FileHTTPBodyStream, ReadASCIIFile) { |
| // TODO(rsesek): Use a more robust mechanism to locate testdata |
| // <https://code.google.com/p/crashpad/issues/detail?id=4>. |
| - base::FilePath path = base::FilePath("util/net/testdata/ascii_http_body.txt"); |
| + base::FilePath path = base::FilePath( |
| + FILE_PATH_LITERAL("util/net/testdata/ascii_http_body.txt")); |
| FileHTTPBodyStream stream(path); |
| std::string contents = ReadStreamToString(&stream, 32); |
| EXPECT_EQ("This is a test.\n", contents); |
| @@ -115,8 +116,8 @@ TEST(FileHTTPBodyStream, ReadBinaryFile) { |
| // HEX contents of file: |FEEDFACE A11A15|. |
| // TODO(rsesek): Use a more robust mechanism to locate testdata |
| // <https://code.google.com/p/crashpad/issues/detail?id=4>. |
| - base::FilePath path = |
| - base::FilePath("util/net/testdata/binary_http_body.dat"); |
| + base::FilePath path = base::FilePath( |
| + FILE_PATH_LITERAL("util/net/testdata/binary_http_body.dat")); |
| // This buffer size was chosen so that reading the file takes multiple reads. |
| uint8_t buf[4]; |
| @@ -144,8 +145,8 @@ TEST(FileHTTPBodyStream, ReadBinaryFile) { |
| } |
| TEST(FileHTTPBodyStream, NonExistentFile) { |
| - base::FilePath path = |
| - base::FilePath("/var/empty/crashpad/util/net/http_body/null"); |
| + base::FilePath path = base::FilePath( |
| + FILE_PATH_LITERAL("/var/empty/crashpad/util/net/http_body/null")); |
| FileHTTPBodyStream stream(path); |
| uint8_t buf = 0xff; |
| @@ -176,10 +177,10 @@ TEST_P(CompositeHTTPBodyStreamBufferSize, ThreeStringParts) { |
| std::string string1("crashpad"); |
| std::string string2("test"); |
| std::string string3("foobar"); |
| - const size_t all_strings_length = string1.length() + string2.length() + |
| - string3.length(); |
| - uint8_t buf[all_strings_length + 3]; |
| - memset(buf, '!', sizeof(buf)); |
| + const size_t all_strings_length = |
|
Mark Mentovai
2015/01/07 22:47:27
We could make this constexpr, but then it’d have t
scottmg
2015/01/07 23:01:11
No constexpr support in VS2013. :(
|
| + string1.length() + string2.length() + string3.length(); |
| + scoped_ptr<uint8_t[]> buf(new uint8_t[all_strings_length + 3]); |
|
Mark Mentovai
2015/01/07 22:47:27
Maybe it’s more natural to make this std::string b
scottmg
2015/01/07 23:01:11
Done.
|
| + memset(buf.get(), '!', all_strings_length + 3); |
| std::vector<HTTPBodyStream*> parts; |
| parts.push_back(new StringHTTPBodyStream(string1)); |
| @@ -191,8 +192,7 @@ TEST_P(CompositeHTTPBodyStreamBufferSize, ThreeStringParts) { |
| std::string actual_string = ReadStreamToString(&stream, GetParam()); |
| EXPECT_EQ(string1 + string2 + string3, actual_string); |
| - ExpectBufferSet(buf + all_strings_length, '!', |
| - sizeof(buf) - all_strings_length); |
| + ExpectBufferSet(buf.get() + all_strings_length, '!', 3); |
| } |
| TEST_P(CompositeHTTPBodyStreamBufferSize, StringsAndFile) { |
| @@ -201,8 +201,8 @@ TEST_P(CompositeHTTPBodyStreamBufferSize, StringsAndFile) { |
| std::vector<HTTPBodyStream*> parts; |
| parts.push_back(new StringHTTPBodyStream(string1)); |
| - parts.push_back(new FileHTTPBodyStream( |
| - base::FilePath("util/net/testdata/ascii_http_body.txt"))); |
| + parts.push_back(new FileHTTPBodyStream(base::FilePath( |
| + FILE_PATH_LITERAL("util/net/testdata/ascii_http_body.txt")))); |
| parts.push_back(new StringHTTPBodyStream(string2)); |
| CompositeHTTPBodyStream stream(parts); |