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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "cc/base/swap_promise.h" | 10 #include "cc/base/swap_promise.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 EXPECT_TRUE(NextSwapMessages().empty()); | 288 EXPECT_TRUE(NextSwapMessages().empty()); |
289 EXPECT_TRUE(frame_swap_message_queue_->Empty()); | 289 EXPECT_TRUE(frame_swap_message_queue_->Empty()); |
290 } | 290 } |
291 | 291 |
292 TEST_F(QueueMessageSwapPromiseTest, VisalStateSwapPromiseDidNotSwapNoUpdate) { | 292 TEST_F(QueueMessageSwapPromiseTest, VisalStateSwapPromiseDidNotSwapNoUpdate) { |
293 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::COMMIT_NO_UPDATE); | 293 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::COMMIT_NO_UPDATE); |
294 } | 294 } |
295 | 295 |
296 TEST_F(QueueMessageSwapPromiseTest, | 296 TEST_F(QueueMessageSwapPromiseTest, |
297 VisalStateSwapPromiseDidNotSwapCommitFails) { | 297 VisualStateSwapPromiseDidNotSwapCommitFails) { |
298 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::COMMIT_FAILS); | 298 // COMMIT_FAILS is treated differently: |
| 299 // If we fail to swap with COMMIT_FAILS, then the renderer is |
| 300 // shutting down, which implies that the RenderFrameHostImpl |
| 301 // destructor will eventually be called, firing the remaining |
| 302 // response callbacks (with swap_success = false) itself. |
| 303 QueueMessageData data[] = { |
| 304 /* { policy, source_frame_number } */ |
| 305 {MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE, 1}, |
| 306 {MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE, 1}, |
| 307 {MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE, 2}, |
| 308 }; |
| 309 QueueMessages(data, arraysize(data)); |
| 310 |
| 311 promises_[0]->DidNotSwap(cc::SwapPromise::COMMIT_FAILS); |
| 312 ASSERT_FALSE(promises_[1]); |
| 313 EXPECT_TRUE(NextSwapMessages().empty()); |
| 314 EXPECT_EQ(0u, DirectSendMessages().size()); |
| 315 EXPECT_FALSE(ContainsMessage(DirectSendMessages(), messages_[0])); |
| 316 EXPECT_FALSE(ContainsMessage(DirectSendMessages(), messages_[1])); |
| 317 EXPECT_FALSE(ContainsMessage(DirectSendMessages(), messages_[2])); |
| 318 |
| 319 promises_[2]->DidNotSwap(cc::SwapPromise::COMMIT_FAILS); |
| 320 EXPECT_TRUE(NextSwapMessages().empty()); |
| 321 EXPECT_FALSE(ContainsMessage(DirectSendMessages(), messages_[2])); |
| 322 |
| 323 EXPECT_TRUE(NextSwapMessages().empty()); |
| 324 EXPECT_FALSE(frame_swap_message_queue_->Empty()); |
299 } | 325 } |
300 | 326 |
301 TEST_F(QueueMessageSwapPromiseTest, VisalStateSwapPromiseDidNotSwapSwapFails) { | 327 TEST_F(QueueMessageSwapPromiseTest, VisalStateSwapPromiseDidNotSwapSwapFails) { |
302 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::SWAP_FAILS); | 328 VisualStateSwapPromiseDidNotSwap(cc::SwapPromise::SWAP_FAILS); |
303 } | 329 } |
304 | 330 |
305 } // namespace content | 331 } // namespace content |
OLD | NEW |