Loading media/libstagefright/tests/writer/AndroidTest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -26,5 +26,6 @@ <option name="native-test-device-path" value="/data/local/tmp" /> <option name="module-name" value="writerTest" /> <option name="native-test-flag" value="-P /data/local/tmp/WriterTestRes/" /> <option name="native-test-flag" value="-C true" /> </test> </configuration> media/libstagefright/tests/writer/README.md +2 −2 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ Download and extract the folder. Push all the files in this folder to /data/loca adb push WriterTestRes /data/local/tmp/ ``` usage: writerTest -P \<path_to_res_folder\> usage: writerTest -P \<path_to_res_folder\> -C <remove_output_file> ``` adb shell /data/local/tmp/writerTest -P /data/local/tmp/WriterTestRes/ adb shell /data/local/tmp/writerTest -P /data/local/tmp/WriterTestRes/ -C true ``` Alternatively, the test can also be run using atest command. Loading media/libstagefright/tests/writer/WriterTest.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ class WriterTest { } mBufferInfo.clear(); if (mInputStream.is_open()) mInputStream.close(); if (gEnv->cleanUp()) remove(OUTPUT_FILE_NAME); } void setupWriterType(string writerFormat) { Loading media/libstagefright/tests/writer/WriterTestEnvironment.h +15 −4 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ using namespace std; class WriterTestEnvironment : public ::testing::Environment { public: WriterTestEnvironment() : res("/data/local/tmp/") {} WriterTestEnvironment() : res("/data/local/tmp/"), deleteOutput(true) {} // Parses the command line arguments int initFromOptions(int argc, char **argv); Loading @@ -34,16 +34,21 @@ class WriterTestEnvironment : public ::testing::Environment { const string getRes() const { return res; } bool cleanUp() const { return deleteOutput; } private: string res; bool deleteOutput; }; int WriterTestEnvironment::initFromOptions(int argc, char **argv) { static struct option options[] = {{"res", required_argument, 0, 'P'}, {0, 0, 0, 0}}; static struct option options[] = {{"res", required_argument, 0, 'P'}, {"cleanUp", optional_argument, 0, 'C'}, {0, 0, 0, 0}}; while (true) { int index = 0; int c = getopt_long(argc, argv, "P:", options, &index); int c = getopt_long(argc, argv, "P:C:", options, &index); if (c == -1) { break; } Loading @@ -52,6 +57,11 @@ int WriterTestEnvironment::initFromOptions(int argc, char **argv) { case 'P': setRes(optarg); break; case 'C': if (!strcmp(optarg, "false")) { deleteOutput = false; } break; default: break; } Loading @@ -62,7 +72,8 @@ int WriterTestEnvironment::initFromOptions(int argc, char **argv) { "unrecognized option: %s\n\n" "usage: %s <gtest options> <test options>\n\n" "test options are:\n\n" "-P, --path: Resource files directory location\n", "-P, --path: Resource files directory location\n" "-C, default:true. Delete output file after test completes\n", argv[optind ?: 1], argv[0]); return 2; } Loading Loading
media/libstagefright/tests/writer/AndroidTest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -26,5 +26,6 @@ <option name="native-test-device-path" value="/data/local/tmp" /> <option name="module-name" value="writerTest" /> <option name="native-test-flag" value="-P /data/local/tmp/WriterTestRes/" /> <option name="native-test-flag" value="-C true" /> </test> </configuration>
media/libstagefright/tests/writer/README.md +2 −2 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ Download and extract the folder. Push all the files in this folder to /data/loca adb push WriterTestRes /data/local/tmp/ ``` usage: writerTest -P \<path_to_res_folder\> usage: writerTest -P \<path_to_res_folder\> -C <remove_output_file> ``` adb shell /data/local/tmp/writerTest -P /data/local/tmp/WriterTestRes/ adb shell /data/local/tmp/writerTest -P /data/local/tmp/WriterTestRes/ -C true ``` Alternatively, the test can also be run using atest command. Loading
media/libstagefright/tests/writer/WriterTest.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ class WriterTest { } mBufferInfo.clear(); if (mInputStream.is_open()) mInputStream.close(); if (gEnv->cleanUp()) remove(OUTPUT_FILE_NAME); } void setupWriterType(string writerFormat) { Loading
media/libstagefright/tests/writer/WriterTestEnvironment.h +15 −4 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ using namespace std; class WriterTestEnvironment : public ::testing::Environment { public: WriterTestEnvironment() : res("/data/local/tmp/") {} WriterTestEnvironment() : res("/data/local/tmp/"), deleteOutput(true) {} // Parses the command line arguments int initFromOptions(int argc, char **argv); Loading @@ -34,16 +34,21 @@ class WriterTestEnvironment : public ::testing::Environment { const string getRes() const { return res; } bool cleanUp() const { return deleteOutput; } private: string res; bool deleteOutput; }; int WriterTestEnvironment::initFromOptions(int argc, char **argv) { static struct option options[] = {{"res", required_argument, 0, 'P'}, {0, 0, 0, 0}}; static struct option options[] = {{"res", required_argument, 0, 'P'}, {"cleanUp", optional_argument, 0, 'C'}, {0, 0, 0, 0}}; while (true) { int index = 0; int c = getopt_long(argc, argv, "P:", options, &index); int c = getopt_long(argc, argv, "P:C:", options, &index); if (c == -1) { break; } Loading @@ -52,6 +57,11 @@ int WriterTestEnvironment::initFromOptions(int argc, char **argv) { case 'P': setRes(optarg); break; case 'C': if (!strcmp(optarg, "false")) { deleteOutput = false; } break; default: break; } Loading @@ -62,7 +72,8 @@ int WriterTestEnvironment::initFromOptions(int argc, char **argv) { "unrecognized option: %s\n\n" "usage: %s <gtest options> <test options>\n\n" "test options are:\n\n" "-P, --path: Resource files directory location\n", "-P, --path: Resource files directory location\n" "-C, default:true. Delete output file after test completes\n", argv[optind ?: 1], argv[0]); return 2; } Loading