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

Unified Diff: util/net/http_multipart_builder_test.cc

Issue 992503002: Locate test data more robustly (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 2015 Created 5 years, 9 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 | « util/net/http_body_test.cc ('k') | util/net/http_transport_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/net/http_multipart_builder_test.cc
diff --git a/util/net/http_multipart_builder_test.cc b/util/net/http_multipart_builder_test.cc
index cb3fbaa7a5ec4e6633c2c71df78251151226e6a5..e185e4ac36d2c066a3fdefd4559d547e416974ea 100644
--- a/util/net/http_multipart_builder_test.cc
+++ b/util/net/http_multipart_builder_test.cc
@@ -19,6 +19,7 @@
#include "gtest/gtest.h"
#include "util/net/http_body.h"
#include "util/net/http_body_test_util.h"
+#include "util/test/paths.h"
namespace crashpad {
namespace test {
@@ -95,22 +96,19 @@ TEST(HTTPMultipartBuilder, ThreeStringFields) {
TEST(HTTPMultipartBuilder, ThreeFileAttachments) {
HTTPMultipartBuilder builder;
- // TODO(rsesek): Use a more robust mechanism to locate testdata
- // <https://code.google.com/p/crashpad/issues/detail?id=4>.
+ base::FilePath ascii_http_body_path = Paths::TestDataRoot().Append(
+ FILE_PATH_LITERAL("util/net/testdata/ascii_http_body.txt"));
builder.SetFileAttachment("first",
"minidump.dmp",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/ascii_http_body.txt")),
+ ascii_http_body_path,
"");
builder.SetFileAttachment("second",
"minidump.dmp",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/ascii_http_body.txt")),
+ ascii_http_body_path,
"text/plain");
builder.SetFileAttachment("\"third 50% silly\"",
"test%foo.txt",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/ascii_http_body.txt")),
+ ascii_http_body_path,
"text/plain");
const char kFileContents[] = "This is a test.\n";
@@ -182,22 +180,22 @@ TEST(HTTPMultipartBuilder, OverwriteFileAttachment) {
HTTPMultipartBuilder builder;
const char kValue[] = "1 2 3 test";
builder.SetFormData("a key", kValue);
- // TODO(rsesek): Use a more robust mechanism to locate testdata
- // <https://code.google.com/p/crashpad/issues/detail?id=4>.
+ base::FilePath testdata_path =
+ Paths::TestDataRoot().Append(FILE_PATH_LITERAL("util/net/testdata"));
builder.SetFileAttachment("minidump",
"minidump.dmp",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/binary_http_body.dat")),
+ testdata_path.Append(FILE_PATH_LITERAL(
+ "binary_http_body.dat")),
"");
builder.SetFileAttachment("minidump2",
"minidump.dmp",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/binary_http_body.dat")),
+ testdata_path.Append(FILE_PATH_LITERAL(
+ "binary_http_body.dat")),
"");
builder.SetFileAttachment("minidump",
"minidump.dmp",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/ascii_http_body.txt")),
+ testdata_path.Append(FILE_PATH_LITERAL(
+ "ascii_http_body.txt")),
"text/plain");
scoped_ptr<HTTPBodyStream> body(builder.GetBodyStream());
ASSERT_TRUE(body.get());
@@ -239,10 +237,11 @@ TEST(HTTPMultipartBuilder, SharedFormDataAndAttachmentKeyNamespace) {
HTTPMultipartBuilder builder;
const char kValue1[] = "11111";
builder.SetFormData("one", kValue1);
+ base::FilePath ascii_http_body_path = Paths::TestDataRoot().Append(
+ FILE_PATH_LITERAL("util/net/testdata/ascii_http_body.txt"));
builder.SetFileAttachment("minidump",
"minidump.dmp",
- base::FilePath(FILE_PATH_LITERAL(
- "util/net/testdata/ascii_http_body.txt")),
+ ascii_http_body_path,
"");
const char kValue2[] = "this is not a file";
builder.SetFormData("minidump", kValue2);
« no previous file with comments | « util/net/http_body_test.cc ('k') | util/net/http_transport_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698