1 // Copyright 2013 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef TESTING_ANDROID_NATIVE_TEST_NATIVE_TEST_UTIL_H_ 6 #define TESTING_ANDROID_NATIVE_TEST_NATIVE_TEST_UTIL_H_ 7 8 #include <stdio.h> 9 #include <string> 10 #include <vector> 11 12 // Helper methods for setting up environment for running gtest tests 13 // inside an APK. 14 namespace testing { 15 namespace android { 16 17 class ScopedMainEntryLogger { 18 public: ScopedMainEntryLogger()19 ScopedMainEntryLogger() { 20 printf(">>ScopedMainEntryLogger\n"); 21 } 22 ~ScopedMainEntryLogger()23 ~ScopedMainEntryLogger() { 24 printf("<<ScopedMainEntryLogger\n"); 25 fflush(stdout); 26 fflush(stderr); 27 } 28 }; 29 30 void ParseArgsFromString( 31 const std::string& command_line, std::vector<std::string>* args); 32 void ParseArgsFromCommandLineFile( 33 const char* path, std::vector<std::string>* args); 34 int ArgsToArgv(const std::vector<std::string>& args, std::vector<char*>* argv); 35 36 } // namespace android 37 } // namespace testing 38 39 #endif // TESTING_ANDROID_NATIVE_TEST_NATIVE_TEST_UTIL_H_ 40