| 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 "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 "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 49   base::LogPerfResult(test_name, value, units); | 49   base::LogPerfResult(test_name, value, units); | 
| 50 } | 50 } | 
| 51 | 51 | 
| 52 FILE* TestSupportImpl::OpenSourceRootRelativeFile(const char* relative_path) { | 52 FILE* TestSupportImpl::OpenSourceRootRelativeFile(const char* relative_path) { | 
| 53   return base::OpenFile(ResolveSourceRootRelativePath(relative_path), "rb"); | 53   return base::OpenFile(ResolveSourceRootRelativePath(relative_path), "rb"); | 
| 54 } | 54 } | 
| 55 | 55 | 
| 56 char** TestSupportImpl::EnumerateSourceRootRelativeDirectory( | 56 char** TestSupportImpl::EnumerateSourceRootRelativeDirectory( | 
| 57     const char* relative_path) { | 57     const char* relative_path) { | 
| 58   std::vector<std::string> names; | 58   std::vector<std::string> names; | 
| 59   base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), false, | 59   base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), | 
|  | 60                          false, | 
| 60                          base::FileEnumerator::FILES); | 61                          base::FileEnumerator::FILES); | 
| 61   for (base::FilePath name = e.Next(); !name.empty(); name = e.Next()) | 62   for (base::FilePath name = e.Next(); !name.empty(); name = e.Next()) | 
| 62     names.push_back(name.BaseName().AsUTF8Unsafe()); | 63     names.push_back(name.BaseName().AsUTF8Unsafe()); | 
| 63 | 64 | 
| 64   // |names.size() + 1| for null terminator. | 65   // |names.size() + 1| for null terminator. | 
| 65   char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*))); | 66   char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*))); | 
| 66   for (size_t i = 0; i < names.size(); ++i) | 67   for (size_t i = 0; i < names.size(); ++i) | 
| 67     rv[i] = base::strdup(names[i].c_str()); | 68     rv[i] = base::strdup(names[i].c_str()); | 
| 68   return rv; | 69   return rv; | 
| 69 } | 70 } | 
| 70 | 71 | 
| 71 }  // namespace test | 72 }  // namespace test | 
| 72 }  // namespace mojo | 73 }  // namespace mojo | 
| OLD | NEW | 
|---|