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

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

Issue 2523773002: [Mojo Video Capture] Move SharedMem Tracker/BufferHandle/Factory from content to media (Closed)
Patch Set: mcasas comments 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>
11 #include <string.h> 11 #include <string.h>
12 12
13 #include <memory> 13 #include <memory>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/bind.h" 17 #include "base/bind.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
21 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "cc/test/test_context_provider.h" 23 #include "cc/test/test_context_provider.h"
24 #include "cc/test/test_web_graphics_context_3d.h" 24 #include "cc/test/test_web_graphics_context_3d.h"
25 #include "components/display_compositor/buffer_queue.h" 25 #include "components/display_compositor/buffer_queue.h"
26 #include "content/browser/renderer_host/media/video_capture_buffer_tracker_facto ry_impl.h"
27 #include "content/browser/renderer_host/media/video_capture_controller.h" 26 #include "content/browser/renderer_host/media/video_capture_controller.h"
28 #include "media/base/video_frame.h" 27 #include "media/base/video_frame.h"
29 #include "media/capture/video/video_capture_buffer_pool_impl.h" 28 #include "media/capture/video/video_capture_buffer_pool_impl.h"
29 #include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
30 #include "testing/gmock/include/gmock/gmock.h" 30 #include "testing/gmock/include/gmock/gmock.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
32 32
33 namespace content { 33 namespace content {
34 34
35 struct PixelFormatAndStorage { 35 struct PixelFormatAndStorage {
36 media::VideoPixelFormat pixel_format; 36 media::VideoPixelFormat pixel_format;
37 media::VideoPixelStorage pixel_storage; 37 media::VideoPixelStorage pixel_storage;
38 }; 38 };
39 39
(...skipping 26 matching lines...) Expand all
66 66
67 private: 67 private:
68 const int id_; 68 const int id_;
69 const scoped_refptr<media::VideoCaptureBufferPool> pool_; 69 const scoped_refptr<media::VideoCaptureBufferPool> pool_;
70 const std::unique_ptr<media::VideoCaptureBufferHandle> buffer_handle_; 70 const std::unique_ptr<media::VideoCaptureBufferHandle> buffer_handle_;
71 }; 71 };
72 72
73 VideoCaptureBufferPoolTest() 73 VideoCaptureBufferPoolTest()
74 : expected_dropped_id_(0), 74 : expected_dropped_id_(0),
75 pool_(new media::VideoCaptureBufferPoolImpl( 75 pool_(new media::VideoCaptureBufferPoolImpl(
76 base::MakeUnique<VideoCaptureBufferTrackerFactoryImpl>(), 76 base::MakeUnique<media::VideoCaptureBufferTrackerFactoryImpl>(),
77 kTestBufferPoolSize)) {} 77 kTestBufferPoolSize)) {}
78 78
79 void ExpectDroppedId(int expected_dropped_id) { 79 void ExpectDroppedId(int expected_dropped_id) {
80 expected_dropped_id_ = expected_dropped_id; 80 expected_dropped_id_ = expected_dropped_id;
81 } 81 }
82 82
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|,
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 ASSERT_NE(nullptr, held_buffers.back().get()); 408 ASSERT_NE(nullptr, held_buffers.back().get());
409 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam()); 409 resurrected = ResurrectLastBuffer(gfx::Size(10, 10), GetParam());
410 ASSERT_EQ(nullptr, resurrected.get()); 410 ASSERT_EQ(nullptr, resurrected.get());
411 } 411 }
412 412
413 INSTANTIATE_TEST_CASE_P(, 413 INSTANTIATE_TEST_CASE_P(,
414 VideoCaptureBufferPoolTest, 414 VideoCaptureBufferPoolTest,
415 testing::ValuesIn(kCapturePixelFormatAndStorages)); 415 testing::ValuesIn(kCapturePixelFormatAndStorages));
416 416
417 } // namespace content 417 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698