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

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

Issue 67923002: Fixes for -Wunused-function on Linux, Android and ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for realz Created 7 years, 1 month 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
« no previous file with comments | « net/ssl/server_bound_cert_service_unittest.cc ('k') | net/tools/balsa/balsa_frame.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 23 matching lines...) Expand all
34 #elif defined(OS_POSIX) 34 #elif defined(OS_POSIX)
35 new_path.append(":"); 35 new_path.append(":");
36 #endif 36 #endif
37 new_path.append(dir_path.c_str()); 37 new_path.append(dir_path.c_str());
38 env->SetVar(kPythonPathEnv, new_path); 38 env->SetVar(kPythonPathEnv, new_path);
39 } 39 }
40 } 40 }
41 41
42 namespace { 42 namespace {
43 43
44 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
44 // Search for |to_try|, rolling up the directory tree from 45 // Search for |to_try|, rolling up the directory tree from
45 // |start_dir|. If found, return true and put the path to |to_try| in 46 // |start_dir|. If found, return true and put the path to |to_try| in
46 // |out_dir|. If not, return false and leave |out_dir| untouched. 47 // |out_dir|. If not, return false and leave |out_dir| untouched.
47 bool TryRelativeToDir(const base::FilePath& start_dir, 48 bool TryRelativeToDir(const base::FilePath& start_dir,
48 const base::FilePath& to_try, 49 const base::FilePath& to_try,
49 base::FilePath* out_dir) { 50 base::FilePath* out_dir) {
50 base::FilePath dir(start_dir); 51 base::FilePath dir(start_dir);
51 while (!base::DirectoryExists(dir.Append(to_try))) { 52 while (!base::DirectoryExists(dir.Append(to_try))) {
52 base::FilePath parent = dir.DirName(); 53 base::FilePath parent = dir.DirName();
53 if (parent == dir) { 54 if (parent == dir) {
54 // We hit the root directory. 55 // We hit the root directory.
55 return false; 56 return false;
56 } 57 }
57 dir = parent; 58 dir = parent;
58 } 59 }
59 *out_dir = dir; 60 *out_dir = dir;
60 return true; 61 return true;
61 } 62 }
63 #endif // defined(OS_MACOSX) || defined(OS_CHROMEOS)
62 64
63 } // namespace 65 } // namespace
64 66
65 bool GetPyProtoPath(base::FilePath* dir) { 67 bool GetPyProtoPath(base::FilePath* dir) {
66 // Locate the Python code generated by the protocol buffers compiler. 68 // Locate the Python code generated by the protocol buffers compiler.
67 base::FilePath generated_code_dir; 69 base::FilePath generated_code_dir;
68 if (!PathService::Get(base::DIR_EXE, &generated_code_dir)) { 70 if (!PathService::Get(base::DIR_EXE, &generated_code_dir)) {
69 LOG(ERROR) << "Can't find " << generated_code_dir.value(); 71 LOG(ERROR) << "Can't find " << generated_code_dir.value();
70 return false; 72 return false;
71 } 73 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 DCHECK(python_cmd); 110 DCHECK(python_cmd);
109 111
110 python_cmd->SetProgram(base::FilePath(FILE_PATH_LITERAL("python"))); 112 python_cmd->SetProgram(base::FilePath(FILE_PATH_LITERAL("python")));
111 113
112 // Launch python in unbuffered mode, so that python output doesn't mix with 114 // Launch python in unbuffered mode, so that python output doesn't mix with
113 // gtest output in buildbot log files. See http://crbug.com/147368. 115 // gtest output in buildbot log files. See http://crbug.com/147368.
114 python_cmd->AppendArg("-u"); 116 python_cmd->AppendArg("-u");
115 117
116 return true; 118 return true;
117 } 119 }
OLDNEW
« no previous file with comments | « net/ssl/server_bound_cert_service_unittest.cc ('k') | net/tools/balsa/balsa_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698