OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/spawned_test_server/local_test_server.h" | 5 #include "net/test/spawned_test_server/local_test_server.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 ScopedPath::ScopedPath(const base::FilePath& path_to_add) | 116 ScopedPath::ScopedPath(const base::FilePath& path_to_add) |
117 : environment_(base::Environment::Create()), | 117 : environment_(base::Environment::Create()), |
118 path_modified_(false) { | 118 path_modified_(false) { |
119 environment_->GetVar("PATH", &old_path_); | 119 environment_->GetVar("PATH", &old_path_); |
120 | 120 |
121 std::string new_value = old_path_; | 121 std::string new_value = old_path_; |
122 if (!new_value.empty()) | 122 if (!new_value.empty()) |
123 new_value += ";"; | 123 new_value += ";"; |
124 | 124 |
125 new_value += WideToUTF8(path_to_add.value()); | 125 new_value += base::WideToUTF8(path_to_add.value()); |
126 | 126 |
127 path_modified_ = environment_->SetVar("PATH", new_value); | 127 path_modified_ = environment_->SetVar("PATH", new_value); |
128 } | 128 } |
129 | 129 |
130 ScopedPath::~ScopedPath() { | 130 ScopedPath::~ScopedPath() { |
131 if (!path_modified_) | 131 if (!path_modified_) |
132 return; | 132 return; |
133 if (old_path_.empty()) | 133 if (old_path_.empty()) |
134 environment_->UnSetVar("PATH"); | 134 environment_->UnSetVar("PATH"); |
135 else | 135 else |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if (!ParseServerData(server_data)) { | 222 if (!ParseServerData(server_data)) { |
223 LOG(ERROR) << "Could not parse server_data: " << server_data; | 223 LOG(ERROR) << "Could not parse server_data: " << server_data; |
224 return false; | 224 return false; |
225 } | 225 } |
226 | 226 |
227 return true; | 227 return true; |
228 } | 228 } |
229 | 229 |
230 } // namespace net | 230 } // namespace net |
231 | 231 |
OLD | NEW |