summaryrefslogtreecommitdiff
path: root/test/camera
diff options
context:
space:
mode:
Diffstat (limited to 'test/camera')
-rw-r--r--test/camera/buffer_import.cpp13
-rw-r--r--test/camera/capture.cpp13
-rw-r--r--test/camera/statemachine.cpp9
3 files changed, 17 insertions, 18 deletions
diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
index 64e96264..72ce7b79 100644
--- a/test/camera/buffer_import.cpp
+++ b/test/camera/buffer_import.cpp
@@ -58,7 +58,7 @@ protected:
const Stream *stream = buffers.begin()->first;
FrameBuffer *buffer = buffers.begin()->second;
- request = camera_->createRequest();
+ request->reuse();
request->addBuffer(stream, buffer);
camera_->queueRequest(request);
}
@@ -98,9 +98,8 @@ protected:
if (ret != TestPass)
return ret;
- std::vector<Request *> requests;
for (const std::unique_ptr<FrameBuffer> &buffer : source.buffers()) {
- Request *request = camera_->createRequest();
+ std::unique_ptr<Request> request = camera_->createRequest();
if (!request) {
std::cout << "Failed to create request" << std::endl;
return TestFail;
@@ -111,7 +110,7 @@ protected:
return TestFail;
}
- requests.push_back(request);
+ requests_.push_back(std::move(request));
}
completeRequestsCount_ = 0;
@@ -125,8 +124,8 @@ protected:
return TestFail;
}
- for (Request *request : requests) {
- if (camera_->queueRequest(request)) {
+ for (std::unique_ptr<Request> &request : requests_) {
+ if (camera_->queueRequest(request.get())) {
std::cout << "Failed to queue request" << std::endl;
return TestFail;
}
@@ -160,6 +159,8 @@ protected:
}
private:
+ std::vector<std::unique_ptr<Request>> requests_;
+
unsigned int completeBuffersCount_;
unsigned int completeRequestsCount_;
std::unique_ptr<CameraConfiguration> config_;
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index 51bbd258..c0770801 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -52,7 +52,7 @@ protected:
const Stream *stream = buffers.begin()->first;
FrameBuffer *buffer = buffers.begin()->second;
- request = camera_->createRequest();
+ request->reuse();
request->addBuffer(stream, buffer);
camera_->queueRequest(request);
}
@@ -98,9 +98,8 @@ protected:
if (ret < 0)
return TestFail;
- std::vector<Request *> requests;
for (const std::unique_ptr<FrameBuffer> &buffer : allocator_->buffers(stream)) {
- Request *request = camera_->createRequest();
+ std::unique_ptr<Request> request = camera_->createRequest();
if (!request) {
cout << "Failed to create request" << endl;
return TestFail;
@@ -111,7 +110,7 @@ protected:
return TestFail;
}
- requests.push_back(request);
+ requests_.push_back(std::move(request));
}
completeRequestsCount_ = 0;
@@ -125,8 +124,8 @@ protected:
return TestFail;
}
- for (Request *request : requests) {
- if (camera_->queueRequest(request)) {
+ for (std::unique_ptr<Request> &request : requests_) {
+ if (camera_->queueRequest(request.get())) {
cout << "Failed to queue request" << endl;
return TestFail;
}
@@ -161,6 +160,8 @@ protected:
return TestPass;
}
+ std::vector<std::unique_ptr<Request>> requests_;
+
std::unique_ptr<CameraConfiguration> config_;
FrameBufferAllocator *allocator_;
};
diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp
index 28faeb91..e63ab298 100644
--- a/test/camera/statemachine.cpp
+++ b/test/camera/statemachine.cpp
@@ -101,13 +101,10 @@ protected:
return TestFail;
/* Test operations which should pass. */
- Request *request2 = camera_->createRequest();
+ std::unique_ptr<Request> request2 = camera_->createRequest();
if (!request2)
return TestFail;
- /* Never handed to hardware so need to manually delete it. */
- delete request2;
-
/* Test valid state transitions, end in Running state. */
if (camera_->release())
return TestFail;
@@ -146,7 +143,7 @@ protected:
return TestFail;
/* Test operations which should pass. */
- Request *request = camera_->createRequest();
+ std::unique_ptr<Request> request = camera_->createRequest();
if (!request)
return TestFail;
@@ -154,7 +151,7 @@ protected:
if (request->addBuffer(stream, allocator_->buffers(stream)[0].get()))
return TestFail;
- if (camera_->queueRequest(request))
+ if (camera_->queueRequest(request.get()))
return TestFail;
/* Test valid state transitions, end in Available state. */