Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 #include <memory> | 6 #include <memory> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 257 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
| 258 | 258 |
| 259 RunUntilIdle(); | 259 RunUntilIdle(); |
| 260 | 260 |
| 261 EXPECT_NE(software_frame.get(), frame.get()); | 261 EXPECT_NE(software_frame.get(), frame.get()); |
| 262 EXPECT_EQ(2u, gles2_->gen_textures); | 262 EXPECT_EQ(2u, gles2_->gen_textures); |
| 263 EXPECT_TRUE(frame->metadata()->IsTrue( | 263 EXPECT_TRUE(frame->metadata()->IsTrue( |
| 264 media::VideoFrameMetadata::READ_LOCK_FENCES_ENABLED)); | 264 media::VideoFrameMetadata::READ_LOCK_FENCES_ENABLED)); |
| 265 } | 265 } |
| 266 | 266 |
| 267 // AllocateGpuMemoryBuffer can return null (e.g: when the GPU process is down). | 267 // CreateGpuMemoryBuffer can return null (e.g: when the GPU process is down). |
|
reveman
2016/11/23 15:21:59
This comment is incorrect. Gpu process being down
sadrul
2016/11/23 16:01:27
I have left the comment as is (I am not sure if I
| |
| 268 // This test checks that in that case we don't crash and still create the | 268 // This test checks that in that case we don't crash and still create the |
| 269 // textures. | 269 // textures. |
| 270 TEST_F(GpuMemoryBufferVideoFramePoolTest, AllocateGpuMemoryBufferFail) { | 270 TEST_F(GpuMemoryBufferVideoFramePoolTest, AllocateGpuMemoryBufferFail) { |
|
reveman
2016/11/23 15:21:59
Maybe change the name of this test too. Not very i
sadrul
2016/11/23 16:01:27
I have changed this.
| |
| 271 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10); | 271 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10); |
| 272 scoped_refptr<VideoFrame> frame; | 272 scoped_refptr<VideoFrame> frame; |
| 273 mock_gpu_factories_->SetFailToAllocateGpuMemoryBufferForTesting(true); | 273 mock_gpu_factories_->SetFailToAllocateGpuMemoryBufferForTesting(true); |
| 274 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( | 274 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( |
| 275 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 275 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
| 276 | 276 |
| 277 RunUntilIdle(); | 277 RunUntilIdle(); |
| 278 | 278 |
| 279 EXPECT_NE(software_frame.get(), frame.get()); | 279 EXPECT_NE(software_frame.get(), frame.get()); |
| 280 EXPECT_EQ(3u, gles2_->gen_textures); | 280 EXPECT_EQ(3u, gles2_->gen_textures); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace media | 283 } // namespace media |
| OLD | NEW |