Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Side by Side Diff: components/exo/buffer_unittest.cc

Issue 2041663002: exo: Handle cross-fade animations properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remote-shell-version-2
Patch Set: remove double negative Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/exo/buffer.cc ('k') | components/exo/surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <GLES2/gl2extchromium.h> 5 #include <GLES2/gl2extchromium.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/context_provider.h" 8 #include "cc/output/context_provider.h"
9 #include "cc/resources/single_release_callback.h" 9 #include "cc/resources/single_release_callback.h"
10 #include "components/exo/buffer.h" 10 #include "components/exo/buffer.h"
(...skipping 22 matching lines...) Expand all
33 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 33 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
34 34
35 // Set the release callback. 35 // Set the release callback.
36 int release_call_count = 0; 36 int release_call_count = 0;
37 buffer->set_release_callback( 37 buffer->set_release_callback(
38 base::Bind(&Release, base::Unretained(&release_call_count))); 38 base::Bind(&Release, base::Unretained(&release_call_count)));
39 39
40 // Produce a texture mailbox for the contents of the buffer. 40 // Produce a texture mailbox for the contents of the buffer.
41 cc::TextureMailbox texture_mailbox; 41 cc::TextureMailbox texture_mailbox;
42 std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback = 42 std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback =
43 buffer->ProduceTextureMailbox(&texture_mailbox, false, false); 43 buffer->ProduceTextureMailbox(&texture_mailbox, false, true);
44 ASSERT_TRUE(buffer_release_callback); 44 ASSERT_TRUE(buffer_release_callback);
45 45
46 // Release buffer. 46 // Release buffer.
47 buffer_release_callback->Run(gpu::SyncToken(), false); 47 buffer_release_callback->Run(gpu::SyncToken(), false);
48 48
49 // Release() should have been called exactly once. 49 // Release() should have been called exactly once.
50 ASSERT_EQ(release_call_count, 1); 50 ASSERT_EQ(release_call_count, 1);
51 } 51 }
52 52
53 TEST_F(BufferTest, IsLost) { 53 TEST_F(BufferTest, IsLost) {
54 gfx::Size buffer_size(256, 256); 54 gfx::Size buffer_size(256, 256);
55 std::unique_ptr<Buffer> buffer( 55 std::unique_ptr<Buffer> buffer(
56 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 56 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
57 57
58 // Acquire a texture mailbox for the contents of the buffer. 58 // Acquire a texture mailbox for the contents of the buffer.
59 cc::TextureMailbox texture_mailbox; 59 cc::TextureMailbox texture_mailbox;
60 std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback = 60 std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback =
61 buffer->ProduceTextureMailbox(&texture_mailbox, false, false); 61 buffer->ProduceTextureMailbox(&texture_mailbox, false, true);
62 ASSERT_TRUE(buffer_release_callback); 62 ASSERT_TRUE(buffer_release_callback);
63 63
64 scoped_refptr<cc::ContextProvider> context_provider = 64 scoped_refptr<cc::ContextProvider> context_provider =
65 aura::Env::GetInstance() 65 aura::Env::GetInstance()
66 ->context_factory() 66 ->context_factory()
67 ->SharedMainThreadContextProvider(); 67 ->SharedMainThreadContextProvider();
68 if (context_provider) { 68 if (context_provider) {
69 gpu::gles2::GLES2Interface* gles2 = context_provider->ContextGL(); 69 gpu::gles2::GLES2Interface* gles2 = context_provider->ContextGL();
70 gles2->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 70 gles2->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
71 GL_INNOCENT_CONTEXT_RESET_ARB); 71 GL_INNOCENT_CONTEXT_RESET_ARB);
72 } 72 }
73 73
74 // Release buffer. 74 // Release buffer.
75 bool is_lost = true; 75 bool is_lost = true;
76 buffer_release_callback->Run(gpu::SyncToken(), is_lost); 76 buffer_release_callback->Run(gpu::SyncToken(), is_lost);
77 77
78 // Producing a new texture mailbox for the contents of the buffer. 78 // Producing a new texture mailbox for the contents of the buffer.
79 buffer_release_callback = 79 buffer_release_callback =
80 buffer->ProduceTextureMailbox(&texture_mailbox, false, is_lost); 80 buffer->ProduceTextureMailbox(&texture_mailbox, false, false);
81 ASSERT_TRUE(buffer_release_callback); 81 ASSERT_TRUE(buffer_release_callback);
82 82
83 // Release buffer. 83 // Release buffer.
84 buffer_release_callback->Run(gpu::SyncToken(), false); 84 buffer_release_callback->Run(gpu::SyncToken(), false);
85 } 85 }
86 86
87 } // namespace 87 } // namespace
88 } // namespace exo 88 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/buffer.cc ('k') | components/exo/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698