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

Side by Side Diff: content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc

Issue 2518143004: [Mojo Video Capture] Replace RESOURCE_UTILIZATION with interface ReceiverLoadObserver (Closed)
Patch Set: Fix for android-only code Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 // Unit test for VideoCaptureBufferPool. 5 // Unit test for VideoCaptureBufferPool.
6 6
7 #include "media/capture/video/video_capture_buffer_pool.h" 7 #include "media/capture/video/video_capture_buffer_pool.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 std::unique_ptr<Buffer> ReserveBuffer( 83 std::unique_ptr<Buffer> ReserveBuffer(
84 const gfx::Size& dimensions, 84 const gfx::Size& dimensions,
85 PixelFormatAndStorage format_and_storage) { 85 PixelFormatAndStorage format_and_storage) {
86 // To verify that ReserveBuffer always sets |buffer_id_to_drop|, 86 // To verify that ReserveBuffer always sets |buffer_id_to_drop|,
87 // initialize it to something different than the expected value. 87 // initialize it to something different than the expected value.
88 int buffer_id_to_drop = ~expected_dropped_id_; 88 int buffer_id_to_drop = ~expected_dropped_id_;
89 DVLOG(1) << media::VideoCaptureFormat::PixelStorageToString( 89 DVLOG(1) << media::VideoCaptureFormat::PixelStorageToString(
90 format_and_storage.pixel_storage) << " " 90 format_and_storage.pixel_storage) << " "
91 << media::VideoPixelFormatToString(format_and_storage.pixel_format) 91 << media::VideoPixelFormatToString(format_and_storage.pixel_format)
92 << " " << dimensions.ToString(); 92 << " " << dimensions.ToString();
93 const int arbitrary_frame_feedback_id = 0;
93 const int buffer_id = pool_->ReserveForProducer( 94 const int buffer_id = pool_->ReserveForProducer(
94 dimensions, format_and_storage.pixel_format, 95 dimensions, format_and_storage.pixel_format,
95 format_and_storage.pixel_storage, &buffer_id_to_drop); 96 format_and_storage.pixel_storage, arbitrary_frame_feedback_id,
97 &buffer_id_to_drop);
96 if (buffer_id == media::VideoCaptureBufferPool::kInvalidId) 98 if (buffer_id == media::VideoCaptureBufferPool::kInvalidId)
97 return std::unique_ptr<Buffer>(); 99 return std::unique_ptr<Buffer>();
98 EXPECT_EQ(expected_dropped_id_, buffer_id_to_drop); 100 EXPECT_EQ(expected_dropped_id_, buffer_id_to_drop);
99 101
100 std::unique_ptr<media::VideoCaptureBufferHandle> buffer_handle = 102 std::unique_ptr<media::VideoCaptureBufferHandle> buffer_handle =
101 pool_->GetBufferHandle(buffer_id); 103 pool_->GetBufferHandle(buffer_id);
102 return std::unique_ptr<Buffer>( 104 return std::unique_ptr<Buffer>(
103 new Buffer(pool_, std::move(buffer_handle), buffer_id)); 105 new Buffer(pool_, std::move(buffer_handle), buffer_id));
104 } 106 }
105 107
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 ASSERT_NE(nullptr, held_buffers.back().get()); 410 ASSERT_NE(nullptr, held_buffers.back().get());
409 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam()); 411 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam());
410 ASSERT_EQ(nullptr, resurrected.get()); 412 ASSERT_EQ(nullptr, resurrected.get());
411 } 413 }
412 414
413 INSTANTIATE_TEST_CASE_P(, 415 INSTANTIATE_TEST_CASE_P(,
414 VideoCaptureBufferPoolTest, 416 VideoCaptureBufferPoolTest,
415 testing::ValuesIn(kCapturePixelFormatAndStorages)); 417 testing::ValuesIn(kCapturePixelFormatAndStorages));
416 418
417 } // namespace content 419 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698