Loading media/libmediatranscoding/TranscodingClientManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ Status TranscodingClientManager::ClientImpl::submitRequest( return Status::fromServiceSpecificError(IMediaTranscodingService::ERROR_DISCONNECTED); } if (in_request.fileName.empty()) { if (in_request.sourceFilePath.empty() || in_request.destinationFilePath.empty()) { // This is the only error we check for now. return Status::ok(); } Loading media/libmediatranscoding/aidl/android/media/TranscodingRequestParcel.aidl +7 −12 Original line number Diff line number Diff line Loading @@ -28,9 +28,14 @@ import android.media.TranscodingVideoTrackFormat; //TODO(hkuang): Implement the parcelable. parcelable TranscodingRequestParcel { /** * Name of file to be transcoded. * The absolute file path of the source file. */ @utf8InCpp String fileName; @utf8InCpp String sourceFilePath; /** * The absolute file path of the destination file. */ @utf8InCpp String destinationFilePath; /** * Type of the transcoding. Loading @@ -45,16 +50,6 @@ parcelable TranscodingRequestParcel { */ @nullable TranscodingVideoTrackFormat requestedVideoTrackFormat; /** * Input source file descriptor. */ @nullable ParcelFileDescriptor inFd; /** * Output transcoded file descriptor. */ @nullable ParcelFileDescriptor outFd; /** * Priority of this transcoding. Service will schedule the transcoding based on the priority. */ Loading media/libmediatranscoding/include/media/TranscodingRequest.h +2 −4 Original line number Diff line number Diff line Loading @@ -35,11 +35,9 @@ public: private: void setTo(const TranscodingRequestParcel& parcel) { fileName = parcel.fileName; sourceFilePath = parcel.sourceFilePath; destinationFilePath = parcel.destinationFilePath; transcodingType = parcel.transcodingType; // TODO: determine if the fds need dup inFd.set(dup(parcel.inFd.get())); outFd.set(dup(parcel.outFd.get())); priority = parcel.priority; requestUpdate = parcel.requestUpdate; } Loading media/libmediatranscoding/tests/TranscodingClientManager_tests.cpp +19 −11 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ struct TestScheduler : public SchedulerClientInterface { // This is the secret name we'll check, to test error propagation from // the scheduler back to client. if (request.fileName == "bad_file") { if (request.sourceFilePath == "bad_source_file") { return false; } Loading Loading @@ -346,33 +346,37 @@ TEST_F(TranscodingClientManagerTest, TestSubmitCancelGetJobs) { // Test jobId assignment. TranscodingRequestParcel request; request.fileName = "test_file_0"; request.sourceFilePath = "test_source_file_0"; request.destinationFilePath = "test_desintaion_file_0"; TranscodingJobParcel job; bool result; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); EXPECT_TRUE(result); EXPECT_EQ(job.jobId, JOB(0)); request.fileName = "test_file_1"; request.sourceFilePath = "test_source_file_1"; request.destinationFilePath = "test_desintaion_file_1"; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); EXPECT_TRUE(result); EXPECT_EQ(job.jobId, JOB(1)); request.fileName = "test_file_2"; request.sourceFilePath = "test_source_file_2"; request.destinationFilePath = "test_desintaion_file_2"; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); EXPECT_TRUE(result); EXPECT_EQ(job.jobId, JOB(2)); // Test submit bad request (no valid fileName) fails. // Test submit bad request (no valid sourceFilePath) fails. TranscodingRequestParcel badRequest; badRequest.fileName = "bad_file"; badRequest.sourceFilePath = "bad_source_file"; badRequest.destinationFilePath = "bad_destination_file"; EXPECT_TRUE(mClient1->submitRequest(badRequest, &job, &result).isOk()); EXPECT_FALSE(result); // Test get jobs by id. EXPECT_TRUE(mClient1->getJobWithId(JOB(2), &job, &result).isOk()); EXPECT_EQ(job.jobId, JOB(2)); EXPECT_EQ(job.request.fileName, "test_file_2"); EXPECT_EQ(job.request.sourceFilePath, "test_source_file_2"); EXPECT_TRUE(result); // Test get jobs by invalid id fails. Loading Loading @@ -417,7 +421,8 @@ TEST_F(TranscodingClientManagerTest, TestClientCallback) { addMultipleClients(); TranscodingRequestParcel request; request.fileName = "test_file_name"; request.sourceFilePath = "test_source_file_name"; request.destinationFilePath = "test_destination_file_name"; TranscodingJobParcel job; bool result; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); Loading Loading @@ -461,12 +466,14 @@ TEST_F(TranscodingClientManagerTest, TestUseAfterUnregister) { TranscodingJobParcel job; bool result; request.fileName = "test_file_0"; request.sourceFilePath = "test_source_file_0"; request.destinationFilePath = "test_destination_file_0"; request.priority = TranscodingJobPriority::kUnspecified; EXPECT_TRUE(client->submitRequest(request, &job, &result).isOk() && result); EXPECT_EQ(job.jobId, JOB(0)); request.fileName = "test_file_1"; request.sourceFilePath = "test_source_file_1"; request.destinationFilePath = "test_destination_file_1"; request.priority = TranscodingJobPriority::kNormal; EXPECT_TRUE(client->submitRequest(request, &job, &result).isOk() && result); EXPECT_EQ(job.jobId, JOB(1)); Loading @@ -476,7 +483,8 @@ TEST_F(TranscodingClientManagerTest, TestUseAfterUnregister) { EXPECT_TRUE(status.isOk()); // Test submit new request after unregister, should fail with ERROR_DISCONNECTED. request.fileName = "test_file_2"; request.sourceFilePath = "test_source_file_2"; request.destinationFilePath = "test_destination_file_2"; request.priority = TranscodingJobPriority::kNormal; status = client->submitRequest(request, &job, &result); EXPECT_FALSE(status.isOk()); Loading services/mediatranscoding/tests/mediatranscodingservice_tests.cpp +35 −33 Original line number Diff line number Diff line Loading @@ -333,14 +333,15 @@ public: template <bool expectation = success> bool submit(const std::shared_ptr<ITranscodingClient>& client, int32_t jobId, const char* filename, const char* sourceFilePath, const char* destinationFilePath, TranscodingJobPriority priority = TranscodingJobPriority::kNormal) { constexpr bool shouldSucceed = (expectation == success); bool result; TranscodingRequestParcel request; TranscodingJobParcel job; request.fileName = filename; request.sourceFilePath = sourceFilePath; request.destinationFilePath = destinationFilePath; request.priority = priority; Status status = client->submitRequest(request, &job, &result); Loading @@ -367,7 +368,7 @@ public: template <bool expectation = success> bool getJob(const std::shared_ptr<ITranscodingClient>& client, int32_t jobId, const char* filename) { const char* sourceFilePath, const char* destinationFilePath) { constexpr bool shouldSucceed = (expectation == success); bool result; TranscodingJobParcel job; Loading @@ -377,11 +378,12 @@ public: EXPECT_EQ(result, shouldSucceed); if (shouldSucceed) { EXPECT_EQ(job.jobId, jobId); EXPECT_EQ(job.request.fileName, filename); EXPECT_EQ(job.request.sourceFilePath, sourceFilePath); } return status.isOk() && (result == shouldSucceed) && (!shouldSucceed || (job.jobId == jobId && job.request.fileName == filename)); (!shouldSucceed || (job.jobId == jobId && job.request.sourceFilePath == sourceFilePath && job.request.destinationFilePath == destinationFilePath)); } std::shared_ptr<IMediaTranscodingService> mService; Loading Loading @@ -487,12 +489,12 @@ TEST_F(MediaTranscodingServiceTest, TestJobIdIndependence) { registerMultipleClients(); // Submit 2 requests on client1 first. EXPECT_TRUE(submit(mClient1, 0, "test_file")); EXPECT_TRUE(submit(mClient1, 1, "test_file")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file", "test_destination_file")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file", "test_destination_file")); // Submit 2 requests on client2, jobId should be independent for each client. EXPECT_TRUE(submit(mClient2, 0, "test_file")); EXPECT_TRUE(submit(mClient2, 1, "test_file")); EXPECT_TRUE(submit(mClient2, 0, "test_source_file", "test_destination_file")); EXPECT_TRUE(submit(mClient2, 1, "test_source_file", "test_destination_file")); // Cancel all jobs. EXPECT_TRUE(cancel(mClient1, 0)); Loading @@ -507,12 +509,12 @@ TEST_F(MediaTranscodingServiceTest, TestSubmitCancelJobs) { registerMultipleClients(); // Test jobId assignment. EXPECT_TRUE(submit(mClient1, 0, "test_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file")); // Test submit bad request (no valid fileName) fails. EXPECT_TRUE(submit<fail>(mClient1, 0, "")); // Test submit bad request (no valid sourceFilePath) fails. EXPECT_TRUE(submit<fail>(mClient1, 0, "", "")); // Test cancel non-existent job fails. EXPECT_TRUE(cancel<fail>(mClient1, 100)); Loading Loading @@ -541,22 +543,22 @@ TEST_F(MediaTranscodingServiceTest, TestGetJobs) { registerMultipleClients(); // Submit 3 requests. EXPECT_TRUE(submit(mClient1, 0, "test_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file_2")); // Test get jobs by id. EXPECT_TRUE(getJob(mClient1, 2, "test_file_2")); EXPECT_TRUE(getJob(mClient1, 1, "test_file_1")); EXPECT_TRUE(getJob(mClient1, 0, "test_file_0")); EXPECT_TRUE(getJob(mClient1, 2, "test_source_file_2", "test_destination_file_2")); EXPECT_TRUE(getJob(mClient1, 1, "test_source_file_1", "test_destination_file_1")); EXPECT_TRUE(getJob(mClient1, 0, "test_source_file_0", "test_destination_file_0")); // Test get job by invalid id fails. EXPECT_TRUE(getJob<fail>(mClient1, 100, "")); EXPECT_TRUE(getJob<fail>(mClient1, -1, "")); EXPECT_TRUE(getJob<fail>(mClient1, 100, "", "")); EXPECT_TRUE(getJob<fail>(mClient1, -1, "", "")); // Test get job after cancel fails. EXPECT_TRUE(cancel(mClient1, 2)); EXPECT_TRUE(getJob<fail>(mClient1, 2, "")); EXPECT_TRUE(getJob<fail>(mClient1, 2, "", "")); // Job 0 should start immediately and finish in 2 seconds, followed by Job 1 start. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 0)); Loading @@ -564,10 +566,10 @@ TEST_F(MediaTranscodingServiceTest, TestGetJobs) { EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 1)); // Test get job after finish fails. EXPECT_TRUE(getJob<fail>(mClient1, 0, "")); EXPECT_TRUE(getJob<fail>(mClient1, 0, "", "")); // Test get the remaining job 1. EXPECT_TRUE(getJob(mClient1, 1, "test_file_1")); EXPECT_TRUE(getJob(mClient1, 1, "test_source_file_1", "test_destination_file_1")); // Cancel remaining job 1. EXPECT_TRUE(cancel(mClient1, 1)); Loading @@ -579,15 +581,15 @@ TEST_F(MediaTranscodingServiceTest, TestSubmitCancelWithOfflineJobs) { registerMultipleClients(); // Submit some offline jobs first. EXPECT_TRUE(submit(mClient1, 0, "test_file_0", TranscodingJobPriority::kUnspecified)); EXPECT_TRUE(submit(mClient1, 1, "test_file_1", TranscodingJobPriority::kUnspecified)); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file_0", TranscodingJobPriority::kUnspecified)); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file_1", TranscodingJobPriority::kUnspecified)); // Job 0 should start immediately. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 0)); // Submit more real-time jobs. EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 3, "test_file_3")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file_2")); EXPECT_TRUE(submit(mClient1, 3, "test_source_file_3", "test_destination_file_3")); // Job 0 should pause immediately and job 2 should start. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Pause(CLIENT(1), 0)); Loading Loading @@ -652,9 +654,9 @@ TEST_F(MediaTranscodingServiceTest, TestTranscodingUidPolicy) { // Submit 3 requests. ALOGD("Submitting job to client1 (app A) ..."); EXPECT_TRUE(submit(mClient1, 0, "test_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file_2")); // Job 0 should start immediately. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 0)); Loading @@ -667,7 +669,7 @@ TEST_F(MediaTranscodingServiceTest, TestTranscodingUidPolicy) { EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 1)); ALOGD("Submitting job to client2 (app B) ..."); EXPECT_TRUE(submit(mClient2, 0, "test_file_0")); EXPECT_TRUE(submit(mClient2, 0, "test_source_file_0", "test_destination_file_0")); // Client1's job should pause, client2's job should start. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Pause(CLIENT(1), 1)); Loading Loading
media/libmediatranscoding/TranscodingClientManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -112,7 +112,7 @@ Status TranscodingClientManager::ClientImpl::submitRequest( return Status::fromServiceSpecificError(IMediaTranscodingService::ERROR_DISCONNECTED); } if (in_request.fileName.empty()) { if (in_request.sourceFilePath.empty() || in_request.destinationFilePath.empty()) { // This is the only error we check for now. return Status::ok(); } Loading
media/libmediatranscoding/aidl/android/media/TranscodingRequestParcel.aidl +7 −12 Original line number Diff line number Diff line Loading @@ -28,9 +28,14 @@ import android.media.TranscodingVideoTrackFormat; //TODO(hkuang): Implement the parcelable. parcelable TranscodingRequestParcel { /** * Name of file to be transcoded. * The absolute file path of the source file. */ @utf8InCpp String fileName; @utf8InCpp String sourceFilePath; /** * The absolute file path of the destination file. */ @utf8InCpp String destinationFilePath; /** * Type of the transcoding. Loading @@ -45,16 +50,6 @@ parcelable TranscodingRequestParcel { */ @nullable TranscodingVideoTrackFormat requestedVideoTrackFormat; /** * Input source file descriptor. */ @nullable ParcelFileDescriptor inFd; /** * Output transcoded file descriptor. */ @nullable ParcelFileDescriptor outFd; /** * Priority of this transcoding. Service will schedule the transcoding based on the priority. */ Loading
media/libmediatranscoding/include/media/TranscodingRequest.h +2 −4 Original line number Diff line number Diff line Loading @@ -35,11 +35,9 @@ public: private: void setTo(const TranscodingRequestParcel& parcel) { fileName = parcel.fileName; sourceFilePath = parcel.sourceFilePath; destinationFilePath = parcel.destinationFilePath; transcodingType = parcel.transcodingType; // TODO: determine if the fds need dup inFd.set(dup(parcel.inFd.get())); outFd.set(dup(parcel.outFd.get())); priority = parcel.priority; requestUpdate = parcel.requestUpdate; } Loading
media/libmediatranscoding/tests/TranscodingClientManager_tests.cpp +19 −11 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ struct TestScheduler : public SchedulerClientInterface { // This is the secret name we'll check, to test error propagation from // the scheduler back to client. if (request.fileName == "bad_file") { if (request.sourceFilePath == "bad_source_file") { return false; } Loading Loading @@ -346,33 +346,37 @@ TEST_F(TranscodingClientManagerTest, TestSubmitCancelGetJobs) { // Test jobId assignment. TranscodingRequestParcel request; request.fileName = "test_file_0"; request.sourceFilePath = "test_source_file_0"; request.destinationFilePath = "test_desintaion_file_0"; TranscodingJobParcel job; bool result; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); EXPECT_TRUE(result); EXPECT_EQ(job.jobId, JOB(0)); request.fileName = "test_file_1"; request.sourceFilePath = "test_source_file_1"; request.destinationFilePath = "test_desintaion_file_1"; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); EXPECT_TRUE(result); EXPECT_EQ(job.jobId, JOB(1)); request.fileName = "test_file_2"; request.sourceFilePath = "test_source_file_2"; request.destinationFilePath = "test_desintaion_file_2"; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); EXPECT_TRUE(result); EXPECT_EQ(job.jobId, JOB(2)); // Test submit bad request (no valid fileName) fails. // Test submit bad request (no valid sourceFilePath) fails. TranscodingRequestParcel badRequest; badRequest.fileName = "bad_file"; badRequest.sourceFilePath = "bad_source_file"; badRequest.destinationFilePath = "bad_destination_file"; EXPECT_TRUE(mClient1->submitRequest(badRequest, &job, &result).isOk()); EXPECT_FALSE(result); // Test get jobs by id. EXPECT_TRUE(mClient1->getJobWithId(JOB(2), &job, &result).isOk()); EXPECT_EQ(job.jobId, JOB(2)); EXPECT_EQ(job.request.fileName, "test_file_2"); EXPECT_EQ(job.request.sourceFilePath, "test_source_file_2"); EXPECT_TRUE(result); // Test get jobs by invalid id fails. Loading Loading @@ -417,7 +421,8 @@ TEST_F(TranscodingClientManagerTest, TestClientCallback) { addMultipleClients(); TranscodingRequestParcel request; request.fileName = "test_file_name"; request.sourceFilePath = "test_source_file_name"; request.destinationFilePath = "test_destination_file_name"; TranscodingJobParcel job; bool result; EXPECT_TRUE(mClient1->submitRequest(request, &job, &result).isOk()); Loading Loading @@ -461,12 +466,14 @@ TEST_F(TranscodingClientManagerTest, TestUseAfterUnregister) { TranscodingJobParcel job; bool result; request.fileName = "test_file_0"; request.sourceFilePath = "test_source_file_0"; request.destinationFilePath = "test_destination_file_0"; request.priority = TranscodingJobPriority::kUnspecified; EXPECT_TRUE(client->submitRequest(request, &job, &result).isOk() && result); EXPECT_EQ(job.jobId, JOB(0)); request.fileName = "test_file_1"; request.sourceFilePath = "test_source_file_1"; request.destinationFilePath = "test_destination_file_1"; request.priority = TranscodingJobPriority::kNormal; EXPECT_TRUE(client->submitRequest(request, &job, &result).isOk() && result); EXPECT_EQ(job.jobId, JOB(1)); Loading @@ -476,7 +483,8 @@ TEST_F(TranscodingClientManagerTest, TestUseAfterUnregister) { EXPECT_TRUE(status.isOk()); // Test submit new request after unregister, should fail with ERROR_DISCONNECTED. request.fileName = "test_file_2"; request.sourceFilePath = "test_source_file_2"; request.destinationFilePath = "test_destination_file_2"; request.priority = TranscodingJobPriority::kNormal; status = client->submitRequest(request, &job, &result); EXPECT_FALSE(status.isOk()); Loading
services/mediatranscoding/tests/mediatranscodingservice_tests.cpp +35 −33 Original line number Diff line number Diff line Loading @@ -333,14 +333,15 @@ public: template <bool expectation = success> bool submit(const std::shared_ptr<ITranscodingClient>& client, int32_t jobId, const char* filename, const char* sourceFilePath, const char* destinationFilePath, TranscodingJobPriority priority = TranscodingJobPriority::kNormal) { constexpr bool shouldSucceed = (expectation == success); bool result; TranscodingRequestParcel request; TranscodingJobParcel job; request.fileName = filename; request.sourceFilePath = sourceFilePath; request.destinationFilePath = destinationFilePath; request.priority = priority; Status status = client->submitRequest(request, &job, &result); Loading @@ -367,7 +368,7 @@ public: template <bool expectation = success> bool getJob(const std::shared_ptr<ITranscodingClient>& client, int32_t jobId, const char* filename) { const char* sourceFilePath, const char* destinationFilePath) { constexpr bool shouldSucceed = (expectation == success); bool result; TranscodingJobParcel job; Loading @@ -377,11 +378,12 @@ public: EXPECT_EQ(result, shouldSucceed); if (shouldSucceed) { EXPECT_EQ(job.jobId, jobId); EXPECT_EQ(job.request.fileName, filename); EXPECT_EQ(job.request.sourceFilePath, sourceFilePath); } return status.isOk() && (result == shouldSucceed) && (!shouldSucceed || (job.jobId == jobId && job.request.fileName == filename)); (!shouldSucceed || (job.jobId == jobId && job.request.sourceFilePath == sourceFilePath && job.request.destinationFilePath == destinationFilePath)); } std::shared_ptr<IMediaTranscodingService> mService; Loading Loading @@ -487,12 +489,12 @@ TEST_F(MediaTranscodingServiceTest, TestJobIdIndependence) { registerMultipleClients(); // Submit 2 requests on client1 first. EXPECT_TRUE(submit(mClient1, 0, "test_file")); EXPECT_TRUE(submit(mClient1, 1, "test_file")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file", "test_destination_file")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file", "test_destination_file")); // Submit 2 requests on client2, jobId should be independent for each client. EXPECT_TRUE(submit(mClient2, 0, "test_file")); EXPECT_TRUE(submit(mClient2, 1, "test_file")); EXPECT_TRUE(submit(mClient2, 0, "test_source_file", "test_destination_file")); EXPECT_TRUE(submit(mClient2, 1, "test_source_file", "test_destination_file")); // Cancel all jobs. EXPECT_TRUE(cancel(mClient1, 0)); Loading @@ -507,12 +509,12 @@ TEST_F(MediaTranscodingServiceTest, TestSubmitCancelJobs) { registerMultipleClients(); // Test jobId assignment. EXPECT_TRUE(submit(mClient1, 0, "test_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file")); // Test submit bad request (no valid fileName) fails. EXPECT_TRUE(submit<fail>(mClient1, 0, "")); // Test submit bad request (no valid sourceFilePath) fails. EXPECT_TRUE(submit<fail>(mClient1, 0, "", "")); // Test cancel non-existent job fails. EXPECT_TRUE(cancel<fail>(mClient1, 100)); Loading Loading @@ -541,22 +543,22 @@ TEST_F(MediaTranscodingServiceTest, TestGetJobs) { registerMultipleClients(); // Submit 3 requests. EXPECT_TRUE(submit(mClient1, 0, "test_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file_2")); // Test get jobs by id. EXPECT_TRUE(getJob(mClient1, 2, "test_file_2")); EXPECT_TRUE(getJob(mClient1, 1, "test_file_1")); EXPECT_TRUE(getJob(mClient1, 0, "test_file_0")); EXPECT_TRUE(getJob(mClient1, 2, "test_source_file_2", "test_destination_file_2")); EXPECT_TRUE(getJob(mClient1, 1, "test_source_file_1", "test_destination_file_1")); EXPECT_TRUE(getJob(mClient1, 0, "test_source_file_0", "test_destination_file_0")); // Test get job by invalid id fails. EXPECT_TRUE(getJob<fail>(mClient1, 100, "")); EXPECT_TRUE(getJob<fail>(mClient1, -1, "")); EXPECT_TRUE(getJob<fail>(mClient1, 100, "", "")); EXPECT_TRUE(getJob<fail>(mClient1, -1, "", "")); // Test get job after cancel fails. EXPECT_TRUE(cancel(mClient1, 2)); EXPECT_TRUE(getJob<fail>(mClient1, 2, "")); EXPECT_TRUE(getJob<fail>(mClient1, 2, "", "")); // Job 0 should start immediately and finish in 2 seconds, followed by Job 1 start. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 0)); Loading @@ -564,10 +566,10 @@ TEST_F(MediaTranscodingServiceTest, TestGetJobs) { EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 1)); // Test get job after finish fails. EXPECT_TRUE(getJob<fail>(mClient1, 0, "")); EXPECT_TRUE(getJob<fail>(mClient1, 0, "", "")); // Test get the remaining job 1. EXPECT_TRUE(getJob(mClient1, 1, "test_file_1")); EXPECT_TRUE(getJob(mClient1, 1, "test_source_file_1", "test_destination_file_1")); // Cancel remaining job 1. EXPECT_TRUE(cancel(mClient1, 1)); Loading @@ -579,15 +581,15 @@ TEST_F(MediaTranscodingServiceTest, TestSubmitCancelWithOfflineJobs) { registerMultipleClients(); // Submit some offline jobs first. EXPECT_TRUE(submit(mClient1, 0, "test_file_0", TranscodingJobPriority::kUnspecified)); EXPECT_TRUE(submit(mClient1, 1, "test_file_1", TranscodingJobPriority::kUnspecified)); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file_0", TranscodingJobPriority::kUnspecified)); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file_1", TranscodingJobPriority::kUnspecified)); // Job 0 should start immediately. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 0)); // Submit more real-time jobs. EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 3, "test_file_3")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file_2")); EXPECT_TRUE(submit(mClient1, 3, "test_source_file_3", "test_destination_file_3")); // Job 0 should pause immediately and job 2 should start. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Pause(CLIENT(1), 0)); Loading Loading @@ -652,9 +654,9 @@ TEST_F(MediaTranscodingServiceTest, TestTranscodingUidPolicy) { // Submit 3 requests. ALOGD("Submitting job to client1 (app A) ..."); EXPECT_TRUE(submit(mClient1, 0, "test_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_file_2")); EXPECT_TRUE(submit(mClient1, 0, "test_source_file_0", "test_destination_file_0")); EXPECT_TRUE(submit(mClient1, 1, "test_source_file_1", "test_destination_file_1")); EXPECT_TRUE(submit(mClient1, 2, "test_source_file_2", "test_destination_file_2")); // Job 0 should start immediately. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 0)); Loading @@ -667,7 +669,7 @@ TEST_F(MediaTranscodingServiceTest, TestTranscodingUidPolicy) { EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Start(CLIENT(1), 1)); ALOGD("Submitting job to client2 (app B) ..."); EXPECT_TRUE(submit(mClient2, 0, "test_file_0")); EXPECT_TRUE(submit(mClient2, 0, "test_source_file_0", "test_destination_file_0")); // Client1's job should pause, client2's job should start. EXPECT_EQ(mClientCallback1->pop(kPaddingUs), EventTracker::Pause(CLIENT(1), 1)); Loading