| 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/queue_message_swap_promise.h" | 5 #include "content/renderer/gpu/queue_message_swap_promise.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/test/scoped_task_environment.h" |
| 14 #include "cc/output/swap_promise.h" | 15 #include "cc/output/swap_promise.h" |
| 15 #include "content/renderer/gpu/frame_swap_message_queue.h" | 16 #include "content/renderer/gpu/frame_swap_message_queue.h" |
| 16 #include "content/renderer/gpu/render_widget_compositor.h" | 17 #include "content/renderer/gpu/render_widget_compositor.h" |
| 17 #include "content/renderer/render_widget.h" | 18 #include "content/renderer/render_widget.h" |
| 18 #include "content/test/mock_render_process.h" | 19 #include "content/test/mock_render_process.h" |
| 19 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
| 20 #include "ipc/ipc_sync_message_filter.h" | 21 #include "ipc/ipc_sync_message_filter.h" |
| 21 #include "ipc/ipc_test_sink.h" | 22 #include "ipc/ipc_test_sink.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 24 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 promise->WillSwap(NULL); | 121 promise->WillSwap(NULL); |
| 121 promise->DidSwap(); | 122 promise->DidSwap(); |
| 122 } | 123 } |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 | 126 |
| 126 protected: | 127 protected: |
| 127 void VisualStateSwapPromiseDidNotSwap( | 128 void VisualStateSwapPromiseDidNotSwap( |
| 128 cc::SwapPromise::DidNotSwapReason reason); | 129 cc::SwapPromise::DidNotSwapReason reason); |
| 129 | 130 |
| 130 base::MessageLoop message_loop_; | 131 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 131 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; | 132 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
| 132 scoped_refptr<TestSyncMessageFilter> sync_message_filter_; | 133 scoped_refptr<TestSyncMessageFilter> sync_message_filter_; |
| 133 std::vector<IPC::Message> messages_; | 134 std::vector<IPC::Message> messages_; |
| 134 std::vector<std::unique_ptr<cc::SwapPromise>> promises_; | 135 std::vector<std::unique_ptr<cc::SwapPromise>> promises_; |
| 135 | 136 |
| 136 private: | 137 private: |
| 137 std::vector<std::unique_ptr<IPC::Message>> next_swap_messages_; | 138 std::vector<std::unique_ptr<IPC::Message>> next_swap_messages_; |
| 138 | 139 |
| 139 DISALLOW_COPY_AND_ASSIGN(QueueMessageSwapPromiseTest); | 140 DISALLOW_COPY_AND_ASSIGN(QueueMessageSwapPromiseTest); |
| 140 }; | 141 }; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 TEST_F(QueueMessageSwapPromiseTest, VisualStateSwapPromiseDidNotSwapSwapFails) { | 319 TEST_F(QueueMessageSwapPromiseTest, VisualStateSwapPromiseDidNotSwapSwapFails) { |
| 319 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::SWAP_FAILS); | 320 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::SWAP_FAILS); |
| 320 } | 321 } |
| 321 | 322 |
| 322 TEST_F(QueueMessageSwapPromiseTest, | 323 TEST_F(QueueMessageSwapPromiseTest, |
| 323 VisualStateSwapPromiseDidNotSwapActivationFails) { | 324 VisualStateSwapPromiseDidNotSwapActivationFails) { |
| 324 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::ACTIVATION_FAILS); | 325 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::ACTIVATION_FAILS); |
| 325 } | 326 } |
| 326 | 327 |
| 327 } // namespace content | 328 } // namespace content |
| OLD | NEW |