OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/policy/test/local_policy_test_server.h" | 5 #include "chrome/browser/policy/test/local_policy_test_server.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 .AppendASCII("python")); | 190 .AppendASCII("python")); |
191 | 191 |
192 // Add the generated python protocol buffer bindings. | 192 // Add the generated python protocol buffer bindings. |
193 base::FilePath pyproto_dir; | 193 base::FilePath pyproto_dir; |
194 if (!GetPyProtoPath(&pyproto_dir)) { | 194 if (!GetPyProtoPath(&pyproto_dir)) { |
195 LOG(ERROR) << "Cannot find pyproto dir for generated code."; | 195 LOG(ERROR) << "Cannot find pyproto dir for generated code."; |
196 return false; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 AppendToPythonPath(pyproto_dir | 199 AppendToPythonPath(pyproto_dir |
200 .AppendASCII("chrome") | |
201 .AppendASCII("browser") | |
202 .AppendASCII("policy") | |
203 .AppendASCII("proto") | |
204 .AppendASCII("cloud")); | |
205 AppendToPythonPath(pyproto_dir | |
206 .AppendASCII("policy") | 200 .AppendASCII("policy") |
207 .AppendASCII("proto")); | 201 .AppendASCII("proto")); |
208 #if defined(OS_CHROMEOS) | 202 #if defined(OS_CHROMEOS) |
209 AppendToPythonPath(pyproto_dir | 203 AppendToPythonPath(pyproto_dir |
210 .AppendASCII("chrome") | 204 .AppendASCII("chrome") |
211 .AppendASCII("browser") | 205 .AppendASCII("browser") |
| 206 .AppendASCII("chromeos") |
212 .AppendASCII("policy") | 207 .AppendASCII("policy") |
213 .AppendASCII("proto") | 208 .AppendASCII("proto")); |
214 .AppendASCII("chromeos")); | |
215 #endif | 209 #endif |
216 | 210 |
217 return true; | 211 return true; |
218 } | 212 } |
219 | 213 |
220 bool LocalPolicyTestServer::GetTestServerPath( | 214 bool LocalPolicyTestServer::GetTestServerPath( |
221 base::FilePath* testserver_path) const { | 215 base::FilePath* testserver_path) const { |
222 base::FilePath source_root; | 216 base::FilePath source_root; |
223 if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root)) { | 217 if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root)) { |
224 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; | 218 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 std::string LocalPolicyTestServer::GetSelector(const std::string& type, | 257 std::string LocalPolicyTestServer::GetSelector(const std::string& type, |
264 const std::string& entity_id) { | 258 const std::string& entity_id) { |
265 std::string selector = type; | 259 std::string selector = type; |
266 if (!entity_id.empty()) | 260 if (!entity_id.empty()) |
267 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); | 261 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); |
268 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); | 262 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); |
269 return selector; | 263 return selector; |
270 } | 264 } |
271 | 265 |
272 } // namespace policy | 266 } // namespace policy |
OLD | NEW |