Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: mojo/edk/test/test_support_impl.cc

Issue 1352913002: Remove Windows support from the EDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper_unittest.cc ('k') | mojo/edk/test/test_utils_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <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/test/perf_log.h" 17 #include "base/test/perf_log.h"
18 #include "build/build_config.h"
19 18
20 namespace mojo { 19 namespace mojo {
21 namespace test { 20 namespace test {
22 namespace { 21 namespace {
23 22
24 base::FilePath ResolveSourceRootRelativePath(const char* relative_path) { 23 base::FilePath ResolveSourceRootRelativePath(const char* relative_path) {
25 // TODO(vtl): Have someone inject the source root instead. 24 // TODO(vtl): Have someone inject the source root instead.
26 base::FilePath path; 25 base::FilePath path;
27 if (!PathService::Get(base::DIR_SOURCE_ROOT, &path)) 26 if (!PathService::Get(base::DIR_SOURCE_ROOT, &path))
28 return base::FilePath(); 27 return base::FilePath();
(...skipping 28 matching lines...) Expand all
57 char** TestSupportImpl::EnumerateSourceRootRelativeDirectory( 56 char** TestSupportImpl::EnumerateSourceRootRelativeDirectory(
58 const char* relative_path) { 57 const char* relative_path) {
59 std::vector<std::string> names; 58 std::vector<std::string> names;
60 base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), false, 59 base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), false,
61 base::FileEnumerator::FILES); 60 base::FileEnumerator::FILES);
62 for (base::FilePath name = e.Next(); !name.empty(); name = e.Next()) 61 for (base::FilePath name = e.Next(); !name.empty(); name = e.Next())
63 names.push_back(name.BaseName().AsUTF8Unsafe()); 62 names.push_back(name.BaseName().AsUTF8Unsafe());
64 63
65 // |names.size() + 1| for null terminator. 64 // |names.size() + 1| for null terminator.
66 char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*))); 65 char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*)));
67 for (size_t i = 0; i < names.size(); ++i) { 66 for (size_t i = 0; i < names.size(); ++i)
68 #if defined(OS_WIN)
69 rv[i] = _strdup(names[i].c_str());
70 #else
71 rv[i] = strdup(names[i].c_str()); 67 rv[i] = strdup(names[i].c_str());
72 #endif
73 }
74 return rv; 68 return rv;
75 } 69 }
76 70
77 } // namespace test 71 } // namespace test
78 } // namespace mojo 72 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/test/multiprocess_test_helper_unittest.cc ('k') | mojo/edk/test/test_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698