Chromium Code Reviews| 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 |