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

Side by Side Diff: cc/output/output_surface_unittest.cc

Issue 22852006: cc: Don't leak the texture returned in CopyOutputRequest ever. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: glrendererleak: fix tests Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "cc/debug/test_context_provider.h" 8 #include "cc/debug/test_context_provider.h"
9 #include "cc/debug/test_web_graphics_context_3d.h" 9 #include "cc/debug/test_web_graphics_context_3d.h"
10 #include "cc/output/managed_memory_policy.h" 10 #include "cc/output/managed_memory_policy.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 output_surface.context_provider()->Context3d()->loseContextCHROMIUM( 92 output_surface.context_provider()->Context3d()->loseContextCHROMIUM(
93 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); 93 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
94 EXPECT_TRUE(client.did_lose_output_surface_called()); 94 EXPECT_TRUE(client.did_lose_output_surface_called());
95 } 95 }
96 96
97 TEST(OutputSurfaceTest, ClientPointerIndicatesBindToClientFailure) { 97 TEST(OutputSurfaceTest, ClientPointerIndicatesBindToClientFailure) {
98 scoped_refptr<TestContextProvider> context_provider = 98 scoped_refptr<TestContextProvider> context_provider =
99 TestContextProvider::Create(); 99 TestContextProvider::Create();
100 100
101 // Lose the context so BindToClient fails. 101 // Lose the context so BindToClient fails.
102 context_provider->TestContext3d()->set_times_make_current_succeeds(0); 102 context_provider->UnboundTestContext3d()->set_times_make_current_succeeds(0);
103 103
104 TestOutputSurface output_surface(context_provider); 104 TestOutputSurface output_surface(context_provider);
105 EXPECT_FALSE(output_surface.HasClient()); 105 EXPECT_FALSE(output_surface.HasClient());
106 106
107 FakeOutputSurfaceClient client; 107 FakeOutputSurfaceClient client;
108 EXPECT_FALSE(output_surface.BindToClient(&client)); 108 EXPECT_FALSE(output_surface.BindToClient(&client));
109 EXPECT_FALSE(output_surface.HasClient()); 109 EXPECT_FALSE(output_surface.HasClient());
110 } 110 }
111 111
112 class OutputSurfaceTestInitializeNewContext3d : public ::testing::Test { 112 class OutputSurfaceTestInitializeNewContext3d : public ::testing::Test {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 context_provider_->Context3d()->loseContextCHROMIUM( 147 context_provider_->Context3d()->loseContextCHROMIUM(
148 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); 148 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
149 EXPECT_TRUE(client_.did_lose_output_surface_called()); 149 EXPECT_TRUE(client_.did_lose_output_surface_called());
150 150
151 output_surface_.ReleaseGL(); 151 output_surface_.ReleaseGL();
152 EXPECT_FALSE(output_surface_.context_provider()); 152 EXPECT_FALSE(output_surface_.context_provider());
153 } 153 }
154 154
155 TEST_F(OutputSurfaceTestInitializeNewContext3d, Context3dMakeCurrentFails) { 155 TEST_F(OutputSurfaceTestInitializeNewContext3d, Context3dMakeCurrentFails) {
156 BindOutputSurface(); 156 BindOutputSurface();
157 context_provider_->TestContext3d()->set_times_make_current_succeeds(0); 157
158 context_provider_->UnboundTestContext3d()
159 ->set_times_make_current_succeeds(0);
158 InitializeNewContextExpectFail(); 160 InitializeNewContextExpectFail();
159 } 161 }
160 162
161 TEST_F(OutputSurfaceTestInitializeNewContext3d, ClientDeferredInitializeFails) { 163 TEST_F(OutputSurfaceTestInitializeNewContext3d, ClientDeferredInitializeFails) {
162 BindOutputSurface(); 164 BindOutputSurface();
163 client_.set_deferred_initialize_result(false); 165 client_.set_deferred_initialize_result(false);
164 InitializeNewContextExpectFail(); 166 InitializeNewContextExpectFail();
165 } 167 }
166 168
167 TEST(OutputSurfaceTest, BeginFrameEmulation) { 169 TEST(OutputSurfaceTest, BeginFrameEmulation) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 402
401 // 0 bytes limit should be ignored. 403 // 0 bytes limit should be ignored.
402 policy.bytes_limit_when_visible = 0; 404 policy.bytes_limit_when_visible = 0;
403 context_provider->SetMemoryAllocation(policy, 405 context_provider->SetMemoryAllocation(policy,
404 discard_backbuffer_when_not_visible); 406 discard_backbuffer_when_not_visible);
405 EXPECT_EQ(1234u, client.memory_policy().bytes_limit_when_visible); 407 EXPECT_EQ(1234u, client.memory_policy().bytes_limit_when_visible);
406 } 408 }
407 409
408 } // namespace 410 } // namespace
409 } // namespace cc 411 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698