| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "third_party/mojo/src/mojo/edk/test/test_support_impl.h" | 5 #include "mojo/edk/test/test_support_impl.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/files/file_enumerator.h" | 12 #include "base/files/file_enumerator.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 20 #include "base/test/perf_log.h" | 20 #include "base/test/perf_log.h" |
| 21 | 21 |
| 22 namespace mojo { | 22 namespace mojo { |
| 23 namespace edk { |
| 23 namespace test { | 24 namespace test { |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 base::FilePath ResolveSourceRootRelativePath(const char* relative_path) { | 27 base::FilePath ResolveSourceRootRelativePath(const char* relative_path) { |
| 27 base::FilePath path; | 28 base::FilePath path; |
| 28 if (!PathService::Get(base::DIR_SOURCE_ROOT, &path)) | 29 if (!PathService::Get(base::DIR_SOURCE_ROOT, &path)) |
| 29 return base::FilePath(); | 30 return base::FilePath(); |
| 30 | 31 |
| 31 for (const base::StringPiece& component : base::SplitStringPiece( | 32 for (const base::StringPiece& component : base::SplitStringPiece( |
| 32 relative_path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | 33 relative_path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 names.push_back(name.BaseName().AsUTF8Unsafe()); | 72 names.push_back(name.BaseName().AsUTF8Unsafe()); |
| 72 | 73 |
| 73 // |names.size() + 1| for null terminator. | 74 // |names.size() + 1| for null terminator. |
| 74 char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*))); | 75 char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*))); |
| 75 for (size_t i = 0; i < names.size(); ++i) | 76 for (size_t i = 0; i < names.size(); ++i) |
| 76 rv[i] = base::strdup(names[i].c_str()); | 77 rv[i] = base::strdup(names[i].c_str()); |
| 77 return rv; | 78 return rv; |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace test | 81 } // namespace test |
| 82 } // namespace edk |
| 81 } // namespace mojo | 83 } // namespace mojo |
| OLD | NEW |