| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/mojo/common/mojo_shared_buffer_video_frame.h" | 5 #include "media/mojo/common/mojo_shared_buffer_video_frame.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "mojo/public/cpp/system/buffer.h" | 14 #include "mojo/public/cpp/system/buffer.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 void CompareDestructionCallbackValues( | 23 void CompareDestructionCallbackValues( |
| 23 mojo::SharedBufferHandle expected_handle, | 24 mojo::SharedBufferHandle expected_handle, |
| 24 uint32_t expected_handle_size, | 25 size_t expected_handle_size, |
| 25 bool* callback_called, | 26 bool* callback_called, |
| 26 mojo::ScopedSharedBufferHandle actual_handle, | 27 mojo::ScopedSharedBufferHandle actual_handle, |
| 27 uint32_t actual_handle_size) { | 28 size_t actual_handle_size) { |
| 28 // Compare expected vs actual. Ownership of the memory is transferred with | 29 // Compare expected vs actual. Ownership of the memory is transferred with |
| 29 // |actual_handle|, thus it is a ScopedSharedBufferHandle. | 30 // |actual_handle|, thus it is a ScopedSharedBufferHandle. |
| 30 EXPECT_EQ(expected_handle, actual_handle.get()); | 31 EXPECT_EQ(expected_handle, actual_handle.get()); |
| 31 EXPECT_EQ(expected_handle_size, actual_handle_size); | 32 EXPECT_EQ(expected_handle_size, actual_handle_size); |
| 32 *callback_called = true; | 33 *callback_called = true; |
| 33 } | 34 } |
| 34 | 35 |
| 35 } // namespace | 36 } // namespace |
| 36 | 37 |
| 37 TEST(MojoSharedBufferVideoFrameTest, CreateFrameWithSharedMemory) { | 38 TEST(MojoSharedBufferVideoFrameTest, CreateFrameWithSharedMemory) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 original_handle, requested_size, | 170 original_handle, requested_size, |
| 170 &callback_called)); | 171 &callback_called)); |
| 171 EXPECT_FALSE(callback_called); | 172 EXPECT_FALSE(callback_called); |
| 172 | 173 |
| 173 // Force destruction of |frame|. | 174 // Force destruction of |frame|. |
| 174 frame = nullptr; | 175 frame = nullptr; |
| 175 EXPECT_TRUE(callback_called); | 176 EXPECT_TRUE(callback_called); |
| 176 } | 177 } |
| 177 | 178 |
| 178 } // namespace media | 179 } // namespace media |
| OLD | NEW |