Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: util/net/http_body_test.cc

Issue 837293002: win: various porting for http_body_test.cc (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@file-writer-test
Patch Set: use string instead of scoped_ptr[] Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8dbd5a1081f0b55868690d2e9765bfe5e9be7a22 100644
--- a/util/net/http_body_test.cc
+++ b/util/net/http_body_test.cc
@@ -14,7 +14,6 @@
#include "util/net/http_body.h"
-#include "base/memory/scoped_ptr.h"
#include "gtest/gtest.h"
#include "util/net/http_body_test_util.h"
@@ -96,7 +95,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 +115,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 +144,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 +176,9 @@ 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 =
+ string1.length() + string2.length() + string3.length();
+ std::string buf(all_strings_length + 3, '!');
std::vector<HTTPBodyStream*> parts;
parts.push_back(new StringHTTPBodyStream(string1));
@@ -191,8 +190,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(reinterpret_cast<uint8_t*>(&buf[all_strings_length]), '!', 3);
}
TEST_P(CompositeHTTPBodyStreamBufferSize, StringsAndFile) {
@@ -201,8 +199,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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698