OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/gpu/frame_swap_message_queue.h" | 5 #include "content/renderer/gpu/frame_swap_message_queue.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class FrameSwapMessageQueueTest : public testing::Test { | 15 class FrameSwapMessageQueueTest : public testing::Test { |
16 public: | 16 public: |
17 FrameSwapMessageQueueTest() | 17 FrameSwapMessageQueueTest() |
18 : first_message_(41, 1, IPC::Message::PRIORITY_NORMAL), | 18 : first_message_(41, 1, IPC::Message::PRIORITY_NORMAL), |
19 second_message_(42, 2, IPC::Message::PRIORITY_NORMAL), | 19 second_message_(42, 2, IPC::Message::PRIORITY_NORMAL), |
20 third_message_(43, 3, IPC::Message::PRIORITY_NORMAL), | 20 third_message_(43, 3, IPC::Message::PRIORITY_NORMAL), |
21 queue_(new FrameSwapMessageQueue(0)) {} | 21 queue_(new FrameSwapMessageQueue()) {} |
22 | 22 |
23 protected: | 23 protected: |
24 void QueueNextSwapMessage(std::unique_ptr<IPC::Message> msg) { | 24 void QueueNextSwapMessage(std::unique_ptr<IPC::Message> msg) { |
25 queue_->QueueMessageForFrame(MESSAGE_DELIVERY_POLICY_WITH_NEXT_SWAP, 0, | 25 queue_->QueueMessageForFrame(MESSAGE_DELIVERY_POLICY_WITH_NEXT_SWAP, 0, |
26 std::move(msg), NULL); | 26 std::move(msg), NULL); |
27 } | 27 } |
28 | 28 |
29 void QueueNextSwapMessage(std::unique_ptr<IPC::Message> msg, bool* first) { | 29 void QueueNextSwapMessage(std::unique_ptr<IPC::Message> msg, bool* first) { |
30 queue_->QueueMessageForFrame(MESSAGE_DELIVERY_POLICY_WITH_NEXT_SWAP, 0, | 30 queue_->QueueMessageForFrame(MESSAGE_DELIVERY_POLICY_WITH_NEXT_SWAP, 0, |
31 std::move(msg), first); | 31 std::move(msg), first); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 std::vector<std::unique_ptr<IPC::Message>> messages; | 299 std::vector<std::unique_ptr<IPC::Message>> messages; |
300 queue_->DidNotSwap(frame, cc::SwapPromise::SWAP_FAILS, &messages); | 300 queue_->DidNotSwap(frame, cc::SwapPromise::SWAP_FAILS, &messages); |
301 CHECK_EQ(1UL, messages.size()); | 301 CHECK_EQ(1UL, messages.size()); |
302 EXPECT_EQ(messages[0].get(), msgSent); | 302 EXPECT_EQ(messages[0].get(), msgSent); |
303 msgSent = nullptr; | 303 msgSent = nullptr; |
304 | 304 |
305 queue_ = nullptr; | 305 queue_ = nullptr; |
306 } | 306 } |
307 | 307 |
308 } // namespace content | 308 } // namespace content |
OLD | NEW |