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

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

Issue 112963005: Update uses of UTF conversions in courgette/, device/, extensions/, google_apis/, gpu/, ipc/, media… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
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 "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 16
17 const char kPythonPathEnv[] = "PYTHONPATH"; 17 const char kPythonPathEnv[] = "PYTHONPATH";
18 18
19 void AppendToPythonPath(const base::FilePath& dir) { 19 void AppendToPythonPath(const base::FilePath& dir) {
20 scoped_ptr<base::Environment> env(base::Environment::Create()); 20 scoped_ptr<base::Environment> env(base::Environment::Create());
21 std::string old_path; 21 std::string old_path;
22 std::string dir_path; 22 std::string dir_path;
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 dir_path = WideToUTF8(dir.value()); 24 dir_path = base::WideToUTF8(dir.value());
25 #elif defined(OS_POSIX) 25 #elif defined(OS_POSIX)
26 dir_path = dir.value(); 26 dir_path = dir.value();
27 #endif 27 #endif
28 if (!env->GetVar(kPythonPathEnv, &old_path)) { 28 if (!env->GetVar(kPythonPathEnv, &old_path)) {
29 env->SetVar(kPythonPathEnv, dir_path.c_str()); 29 env->SetVar(kPythonPathEnv, dir_path.c_str());
30 } else if (old_path.find(dir_path) == std::string::npos) { 30 } else if (old_path.find(dir_path) == std::string::npos) {
31 std::string new_path(old_path); 31 std::string new_path(old_path);
32 #if defined(OS_WIN) 32 #if defined(OS_WIN)
33 new_path.append(";"); 33 new_path.append(";");
34 #elif defined(OS_POSIX) 34 #elif defined(OS_POSIX)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 python_cmd->AppendArg("python"); 116 python_cmd->AppendArg("python");
117 #else 117 #else
118 python_cmd->SetProgram(base::FilePath(FILE_PATH_LITERAL("python"))); 118 python_cmd->SetProgram(base::FilePath(FILE_PATH_LITERAL("python")));
119 #endif // defined(OS_WIN) 119 #endif // defined(OS_WIN)
120 // Launch python in unbuffered mode, so that python output doesn't mix with 120 // Launch python in unbuffered mode, so that python output doesn't mix with
121 // gtest output in buildbot log files. See http://crbug.com/147368. 121 // gtest output in buildbot log files. See http://crbug.com/147368.
122 python_cmd->AppendArg("-u"); 122 python_cmd->AppendArg("-u");
123 123
124 return true; 124 return true;
125 } 125 }
OLDNEW
« no previous file with comments | « net/spdy/spdy_proxy_client_socket_unittest.cc ('k') | net/test/spawned_test_server/local_test_server_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698