OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 | 308 |
309 weakPointer->markContentsChanged(); | 309 weakPointer->markContentsChanged(); |
310 weakPointer->mailboxReleased(mailbox2); | 310 weakPointer->mailboxReleased(mailbox2); |
311 EXPECT_EQ(live, true); | 311 EXPECT_EQ(live, true); |
312 | 312 |
313 weakPointer->markContentsChanged(); | 313 weakPointer->markContentsChanged(); |
314 weakPointer->mailboxReleased(mailbox3); | 314 weakPointer->mailboxReleased(mailbox3); |
315 EXPECT_EQ(live, false); | 315 EXPECT_EQ(live, false); |
316 } | 316 } |
317 | 317 |
318 TEST_F(DrawingBufferTest, verifyClearDrawingBufferIfResourceLost) | |
Ken Russell (switch to Gerrit)
2014/07/28 21:25:13
This test looks pretty good, but the name could be
Hongbo Min
2014/07/29 00:46:48
Done.
| |
319 { | |
320 bool live = true; | |
321 m_drawingBuffer->m_live = &live; | |
322 blink::WebExternalTextureMailbox mailbox1; | |
323 blink::WebExternalTextureMailbox mailbox2; | |
324 blink::WebExternalTextureMailbox mailbox3; | |
325 | |
326 m_drawingBuffer->markContentsChanged(); | |
327 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); | |
328 m_drawingBuffer->markContentsChanged(); | |
329 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); | |
330 m_drawingBuffer->markContentsChanged(); | |
331 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); | |
332 | |
333 m_drawingBuffer->markContentsChanged(); | |
334 m_drawingBuffer->mailboxReleased(mailbox1, true); | |
335 EXPECT_EQ(live, true); | |
336 | |
337 m_drawingBuffer->beginDestruction(); | |
338 EXPECT_EQ(live, true); | |
339 | |
340 m_drawingBuffer->markContentsChanged(); | |
341 m_drawingBuffer->mailboxReleased(mailbox2, false); | |
342 EXPECT_EQ(live, true); | |
343 | |
344 DrawingBufferForTests* weakPtr = m_drawingBuffer.get(); | |
345 m_drawingBuffer.clear(); | |
346 EXPECT_EQ(live, true); | |
347 | |
348 weakPtr->markContentsChanged(); | |
349 weakPtr->mailboxReleased(mailbox3, true); | |
350 EXPECT_EQ(live, false); | |
351 } | |
352 | |
318 class TextureMailboxWrapper { | 353 class TextureMailboxWrapper { |
319 public: | 354 public: |
320 explicit TextureMailboxWrapper(const blink::WebExternalTextureMailbox& mailb ox) | 355 explicit TextureMailboxWrapper(const blink::WebExternalTextureMailbox& mailb ox) |
321 : m_mailbox(mailbox) | 356 : m_mailbox(mailbox) |
322 { } | 357 { } |
323 | 358 |
324 bool operator==(const TextureMailboxWrapper& other) const | 359 bool operator==(const TextureMailboxWrapper& other) const |
325 { | 360 { |
326 return !memcmp(m_mailbox.name, other.m_mailbox.name, sizeof(m_mailbox.na me)); | 361 return !memcmp(m_mailbox.name, other.m_mailbox.name, sizeof(m_mailbox.na me)); |
327 } | 362 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 } else { | 653 } else { |
619 EXPECT_EQ(0u, trackingContext->stencilAttachment()); | 654 EXPECT_EQ(0u, trackingContext->stencilAttachment()); |
620 EXPECT_EQ(0u, trackingContext->depthAttachment()); | 655 EXPECT_EQ(0u, trackingContext->depthAttachment()); |
621 } | 656 } |
622 | 657 |
623 drawingBuffer->beginDestruction(); | 658 drawingBuffer->beginDestruction(); |
624 } | 659 } |
625 } | 660 } |
626 | 661 |
627 } // namespace | 662 } // namespace |
OLD | NEW |