mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Use file_util::WriteFile instead of ofstream (issue #1013).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1527 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -2,7 +2,6 @@
|
|||||||
// reserved. Use of this source code is governed by a BSD-style license that
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
// can be found in the LICENSE file.
|
// can be found in the LICENSE file.
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -15,6 +14,7 @@
|
|||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
|
#include "base/file_util.h"
|
||||||
#include "base/files/scoped_temp_dir.h"
|
#include "base/files/scoped_temp_dir.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
@ -649,12 +649,11 @@ class RequestTestRunner {
|
|||||||
settings_.request->SetMethod("POST");
|
settings_.request->SetMethod("POST");
|
||||||
|
|
||||||
EXPECT_TRUE(post_file_tmpdir_.CreateUniqueTempDir());
|
EXPECT_TRUE(post_file_tmpdir_.CreateUniqueTempDir());
|
||||||
base::FilePath path =
|
const base::FilePath& path =
|
||||||
post_file_tmpdir_.path().Append(FILE_PATH_LITERAL("example.txt"));
|
post_file_tmpdir_.path().Append(FILE_PATH_LITERAL("example.txt"));
|
||||||
std::ofstream myfile;
|
const char content[] = "HELLO FRIEND!";
|
||||||
myfile.open(path.value());
|
int write_ct = file_util::WriteFile(path, content, sizeof(content) - 1);
|
||||||
myfile << "HELLO FRIEND!";
|
EXPECT_EQ(sizeof(content) - 1, write_ct);
|
||||||
myfile.close();
|
|
||||||
SetUploadFile(settings_.request, path);
|
SetUploadFile(settings_.request, path);
|
||||||
|
|
||||||
settings_.response = CefResponse::Create();
|
settings_.response = CefResponse::Create();
|
||||||
|
Reference in New Issue
Block a user