| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // Search for |to_try|, rolling up the directory tree from | 44 // 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 | 45 // |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. | 46 // |out_dir|. If not, return false and leave |out_dir| untouched. |
| 47 bool TryRelativeToDir(const base::FilePath& start_dir, | 47 bool TryRelativeToDir(const base::FilePath& start_dir, |
| 48 const base::FilePath& to_try, | 48 const base::FilePath& to_try, |
| 49 base::FilePath* out_dir) { | 49 base::FilePath* out_dir) { |
| 50 base::FilePath dir(start_dir); | 50 base::FilePath dir(start_dir); |
| 51 while (!file_util::DirectoryExists(dir.Append(to_try))) { | 51 while (!base::DirectoryExists(dir.Append(to_try))) { |
| 52 base::FilePath parent = dir.DirName(); | 52 base::FilePath parent = dir.DirName(); |
| 53 if (parent == dir) { | 53 if (parent == dir) { |
| 54 // We hit the root directory. | 54 // We hit the root directory. |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 dir = parent; | 57 dir = parent; |
| 58 } | 58 } |
| 59 *out_dir = dir; | 59 *out_dir = dir; |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 #endif | 118 #endif |
| 119 | 119 |
| 120 python_cmd->SetProgram(dir); | 120 python_cmd->SetProgram(dir); |
| 121 | 121 |
| 122 // Launch python in unbuffered mode, so that python output doesn't mix with | 122 // Launch python in unbuffered mode, so that python output doesn't mix with |
| 123 // gtest output in buildbot log files. See http://crbug.com/147368. | 123 // gtest output in buildbot log files. See http://crbug.com/147368. |
| 124 python_cmd->AppendArg("-u"); | 124 python_cmd->AppendArg("-u"); |
| 125 | 125 |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| OLD | NEW |