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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 base::FilePath pyproto_dir; | 171 base::FilePath pyproto_dir; |
172 if (!GetPyProtoPath(&pyproto_dir)) { | 172 if (!GetPyProtoPath(&pyproto_dir)) { |
173 LOG(ERROR) << "Cannot find pyproto dir for generated code."; | 173 LOG(ERROR) << "Cannot find pyproto dir for generated code."; |
174 return false; | 174 return false; |
175 } | 175 } |
176 | 176 |
177 AppendToPythonPath(pyproto_dir | 177 AppendToPythonPath(pyproto_dir |
178 .AppendASCII("chrome") | 178 .AppendASCII("chrome") |
179 .AppendASCII("browser") | 179 .AppendASCII("browser") |
180 .AppendASCII("policy") | 180 .AppendASCII("policy") |
181 .AppendASCII("cloud") | 181 .AppendASCII("proto") |
182 .AppendASCII("proto")); | 182 .AppendASCII("cloud")); |
183 AppendToPythonPath(pyproto_dir | 183 AppendToPythonPath(pyproto_dir |
184 .AppendASCII("policy") | 184 .AppendASCII("policy") |
185 .AppendASCII("proto")); | 185 .AppendASCII("proto")); |
186 #if defined(OS_CHROMEOS) | 186 #if defined(OS_CHROMEOS) |
187 AppendToPythonPath(pyproto_dir | 187 AppendToPythonPath(pyproto_dir |
188 .AppendASCII("chrome") | 188 .AppendASCII("chrome") |
189 .AppendASCII("browser") | 189 .AppendASCII("browser") |
190 .AppendASCII("chromeos") | |
191 .AppendASCII("policy") | 190 .AppendASCII("policy") |
192 .AppendASCII("proto")); | 191 .AppendASCII("proto") |
| 192 .AppendASCII("chromeos")); |
193 #endif | 193 #endif |
194 | 194 |
195 return true; | 195 return true; |
196 } | 196 } |
197 | 197 |
198 bool LocalPolicyTestServer::GetTestServerPath( | 198 bool LocalPolicyTestServer::GetTestServerPath( |
199 base::FilePath* testserver_path) const { | 199 base::FilePath* testserver_path) const { |
200 base::FilePath source_root; | 200 base::FilePath source_root; |
201 if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root)) { | 201 if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root)) { |
202 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; | 202 LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 std::string LocalPolicyTestServer::GetSelector(const std::string& type, | 241 std::string LocalPolicyTestServer::GetSelector(const std::string& type, |
242 const std::string& entity_id) { | 242 const std::string& entity_id) { |
243 std::string selector = type; | 243 std::string selector = type; |
244 if (!entity_id.empty()) | 244 if (!entity_id.empty()) |
245 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); | 245 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); |
246 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); | 246 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); |
247 return selector; | 247 return selector; |
248 } | 248 } |
249 | 249 |
250 } // namespace policy; | 250 } // namespace policy; |
OLD | NEW |