From 527f1aa5da433e24c98fe94299828dbdfb80cf0d Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 25 Nov 2013 18:53:13 +0000 Subject: [PATCH] Use file_util::WriteFile instead of ofstream (issue #1013). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1527 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- tests/unittests/urlrequest_unittest.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/unittests/urlrequest_unittest.cc b/tests/unittests/urlrequest_unittest.cc index fda417a01..620bd30e0 100644 --- a/tests/unittests/urlrequest_unittest.cc +++ b/tests/unittests/urlrequest_unittest.cc @@ -2,7 +2,6 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#include #include #include @@ -15,6 +14,7 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/strings/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" @@ -649,12 +649,11 @@ class RequestTestRunner { settings_.request->SetMethod("POST"); EXPECT_TRUE(post_file_tmpdir_.CreateUniqueTempDir()); - base::FilePath path = + const base::FilePath& path = post_file_tmpdir_.path().Append(FILE_PATH_LITERAL("example.txt")); - std::ofstream myfile; - myfile.open(path.value()); - myfile << "HELLO FRIEND!"; - myfile.close(); + const char content[] = "HELLO FRIEND!"; + int write_ct = file_util::WriteFile(path, content, sizeof(content) - 1); + EXPECT_EQ(sizeof(content) - 1, write_ct); SetUploadFile(settings_.request, path); settings_.response = CefResponse::Create();