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

Unified Diff: media/gpu/jpeg_decode_accelerator_unittest.cc

Issue 2746073002: JDA unittest: add an abort test case. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/jpeg_decode_accelerator_unittest.cc
diff --git a/media/gpu/jpeg_decode_accelerator_unittest.cc b/media/gpu/jpeg_decode_accelerator_unittest.cc
index 00fa4f5b2121de602ba67edf26d6b31cffffe09a..1bdf1d3797c0292d15df8674b04346b7c5dc662b 100644
--- a/media/gpu/jpeg_decode_accelerator_unittest.cc
+++ b/media/gpu/jpeg_decode_accelerator_unittest.cc
@@ -439,7 +439,7 @@ class JpegDecodeAcceleratorTest : public ::testing::Test {
};
void JpegDecodeAcceleratorTest::TestDecode(size_t num_concurrent_decoders) {
- LOG_ASSERT(test_image_files_.size() == expected_status_.size());
+ LOG_ASSERT(test_image_files_.size() >= expected_status_.size());
base::Thread decoder_thread("DecoderThread");
ASSERT_TRUE(decoder_thread.Start());
@@ -461,8 +461,10 @@ void JpegDecodeAcceleratorTest::TestDecode(size_t num_concurrent_decoders) {
FROM_HERE, base::Bind(&JpegClient::StartDecode,
base::Unretained(clients[i]), index));
}
- for (size_t i = 0; i < num_concurrent_decoders; i++) {
- ASSERT_EQ(notes[i]->Wait(), expected_status_[index]);
+ if (index < expected_status_.size()) {
+ for (size_t i = 0; i < num_concurrent_decoders; i++) {
+ ASSERT_EQ(notes[i]->Wait(), expected_status_[index]);
+ }
}
}
@@ -530,6 +532,17 @@ TEST_F(JpegDecodeAcceleratorTest, KeepDecodeAfterFailure) {
TestDecode(1);
}
+TEST_F(JpegDecodeAcceleratorTest, Abort) {
+ const int kNumOfJpegToDecode = 5;
jcliang 2017/03/13 08:52:34 const size_t
wuchengli 2017/03/13 14:20:08 Will fix in next PS.
+ for (int j = 0; j < kNumOfJpegToDecode; j++)
jcliang 2017/03/13 08:52:34 size_t j
wuchengli 2017/03/13 14:20:08 Will fix in next PS.
+ test_image_files_.push_back(g_env->image_data_1280x720_default_.get());
+ // Verify only one decode success and ensure both decoders have started the
+ // decoding. Then destroy the first decoder when it is still decoding. The
jcliang 2017/03/13 08:52:34 Are we relying on TestDecode() to destroy the firs
wuchengli 2017/03/13 14:20:08 Yes. We are relying on TestDecode() to destroy the
+ // kernel should not crash during this test.
+ expected_status_.push_back(CS_DECODE_PASS);
+ TestDecode(2);
+}
+
} // namespace
} // namespace media
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698