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

Side by Side Diff: testing/android/native_test_util.cc

Issue 1071573003: [Android] Move testing/android/ to testing/android/native_test/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removing errant commit Created 5 years, 8 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 | « testing/android/native_test_util.h ('k') | testing/test.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "testing/android/native_test_util.h"
6
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/strings/string_tokenizer.h"
10 #include "base/strings/string_util.h"
11
12 namespace testing {
13 namespace native_test_util {
14
15 void ParseArgsFromString(const std::string& command_line,
16 std::vector<std::string>* args) {
17 base::StringTokenizer tokenizer(command_line, base::kWhitespaceASCII);
18 tokenizer.set_quote_chars("\"");
19 while (tokenizer.GetNext()) {
20 std::string token;
21 base::RemoveChars(tokenizer.token(), "\"", &token);
22 args->push_back(token);
23 }
24 }
25
26 void ParseArgsFromCommandLineFile(
27 const char* path, std::vector<std::string>* args) {
28 base::FilePath command_line(path);
29 std::string command_line_string;
30 if (base::ReadFileToString(command_line, &command_line_string)) {
31 ParseArgsFromString(command_line_string, args);
32 }
33 }
34
35 int ArgsToArgv(const std::vector<std::string>& args,
36 std::vector<char*>* argv) {
37 // We need to pass in a non-const char**.
38 int argc = args.size();
39
40 argv->resize(argc + 1);
41 for (int i = 0; i < argc; ++i) {
42 (*argv)[i] = const_cast<char*>(args[i].c_str());
43 }
44 (*argv)[argc] = NULL; // argv must be NULL terminated.
45
46 return argc;
47 }
48
49 } // namespace native_test_util
50 } // namespace testing
OLDNEW
« no previous file with comments | « testing/android/native_test_util.h ('k') | testing/test.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698