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

Side by Side Diff: net/test/python_utils.cc

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/test/python_utils.h" 5 #include "net/test/python_utils.h"
6 6
7 #include <memory>
8
7 #include "base/base_paths.h" 9 #include "base/base_paths.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/environment.h" 11 #include "base/environment.h"
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
12 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
13 #include "base/logging.h" 15 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/path_service.h" 16 #include "base/path_service.h"
16 #include "base/process/launch.h" 17 #include "base/process/launch.h"
17 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 20
20 #if defined(OS_MACOSX) 21 #if defined(OS_MACOSX)
21 #include "base/mac/foundation_util.h" 22 #include "base/mac/foundation_util.h"
22 #endif 23 #endif
23 24
24 const char kPythonPathEnv[] = "PYTHONPATH"; 25 const char kPythonPathEnv[] = "PYTHONPATH";
25 26
26 void AppendToPythonPath(const base::FilePath& dir) { 27 void AppendToPythonPath(const base::FilePath& dir) {
27 scoped_ptr<base::Environment> env(base::Environment::Create()); 28 std::unique_ptr<base::Environment> env(base::Environment::Create());
28 std::string old_path; 29 std::string old_path;
29 std::string dir_path; 30 std::string dir_path;
30 #if defined(OS_WIN) 31 #if defined(OS_WIN)
31 dir_path = base::WideToUTF8(dir.value()); 32 dir_path = base::WideToUTF8(dir.value());
32 #elif defined(OS_POSIX) 33 #elif defined(OS_POSIX)
33 dir_path = dir.value(); 34 dir_path = dir.value();
34 #endif 35 #endif
35 if (!env->GetVar(kPythonPathEnv, &old_path)) { 36 if (!env->GetVar(kPythonPathEnv, &old_path)) {
36 env->SetVar(kPythonPathEnv, dir_path.c_str()); 37 env->SetVar(kPythonPathEnv, dir_path.c_str());
37 } else if (old_path.find(dir_path) == std::string::npos) { 38 } else if (old_path.find(dir_path) == std::string::npos) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #else 111 #else
111 python_cmd->SetProgram(base::FilePath(FILE_PATH_LITERAL("python"))); 112 python_cmd->SetProgram(base::FilePath(FILE_PATH_LITERAL("python")));
112 #endif 113 #endif
113 114
114 // Launch python in unbuffered mode, so that python output doesn't mix with 115 // Launch python in unbuffered mode, so that python output doesn't mix with
115 // gtest output in buildbot log files. See http://crbug.com/147368. 116 // gtest output in buildbot log files. See http://crbug.com/147368.
116 python_cmd->AppendArg("-u"); 117 python_cmd->AppendArg("-u");
117 118
118 return true; 119 return true;
119 } 120 }
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/request_handler_util.cc ('k') | net/test/python_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698