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

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

Issue 132163004: Remove WebGraphicsContext3D getter from cc::ContextProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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/output/managed_memory_policy.h" 8 #include "cc/output/managed_memory_policy.h"
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
10 #include "cc/output/software_output_device.h" 10 #include "cc/output/software_output_device.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 TestOutputSurface output_surface(TestContextProvider::Create()); 135 TestOutputSurface output_surface(TestContextProvider::Create());
136 EXPECT_FALSE(output_surface.HasClient()); 136 EXPECT_FALSE(output_surface.HasClient());
137 137
138 FakeOutputSurfaceClient client; 138 FakeOutputSurfaceClient client;
139 EXPECT_TRUE(output_surface.BindToClient(&client)); 139 EXPECT_TRUE(output_surface.BindToClient(&client));
140 EXPECT_TRUE(output_surface.HasClient()); 140 EXPECT_TRUE(output_surface.HasClient());
141 EXPECT_FALSE(client.deferred_initialize_called()); 141 EXPECT_FALSE(client.deferred_initialize_called());
142 142
143 // Verify DidLoseOutputSurface callback is hooked up correctly. 143 // Verify DidLoseOutputSurface callback is hooked up correctly.
144 EXPECT_FALSE(client.did_lose_output_surface_called()); 144 EXPECT_FALSE(client.did_lose_output_surface_called());
145 output_surface.context_provider()->Context3d()->loseContextCHROMIUM( 145 output_surface.context_provider()->ContextGL()->LoseContextCHROMIUM(
146 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); 146 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
147 output_surface.context_provider()->ContextGL()->Flush();
147 EXPECT_TRUE(client.did_lose_output_surface_called()); 148 EXPECT_TRUE(client.did_lose_output_surface_called());
148 } 149 }
149 150
150 TEST(OutputSurfaceTest, ClientPointerIndicatesBindToClientFailure) { 151 TEST(OutputSurfaceTest, ClientPointerIndicatesBindToClientFailure) {
151 scoped_refptr<TestContextProvider> context_provider = 152 scoped_refptr<TestContextProvider> context_provider =
152 TestContextProvider::Create(); 153 TestContextProvider::Create();
153 154
154 // Lose the context so BindToClient fails. 155 // Lose the context so BindToClient fails.
155 context_provider->UnboundTestContext3d()->set_context_lost(true); 156 context_provider->UnboundTestContext3d()->set_context_lost(true);
156 157
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 191
191 TEST_F(OutputSurfaceTestInitializeNewContext3d, Success) { 192 TEST_F(OutputSurfaceTestInitializeNewContext3d, Success) {
192 BindOutputSurface(); 193 BindOutputSurface();
193 EXPECT_FALSE(client_.deferred_initialize_called()); 194 EXPECT_FALSE(client_.deferred_initialize_called());
194 195
195 EXPECT_TRUE(output_surface_.InitializeNewContext3d(context_provider_)); 196 EXPECT_TRUE(output_surface_.InitializeNewContext3d(context_provider_));
196 EXPECT_TRUE(client_.deferred_initialize_called()); 197 EXPECT_TRUE(client_.deferred_initialize_called());
197 EXPECT_EQ(context_provider_, output_surface_.context_provider()); 198 EXPECT_EQ(context_provider_, output_surface_.context_provider());
198 199
199 EXPECT_FALSE(client_.did_lose_output_surface_called()); 200 EXPECT_FALSE(client_.did_lose_output_surface_called());
200 context_provider_->Context3d()->loseContextCHROMIUM( 201 context_provider_->ContextGL()->LoseContextCHROMIUM(
201 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); 202 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
203 context_provider_->ContextGL()->Flush();
202 EXPECT_TRUE(client_.did_lose_output_surface_called()); 204 EXPECT_TRUE(client_.did_lose_output_surface_called());
203 205
204 output_surface_.ReleaseGL(); 206 output_surface_.ReleaseGL();
205 EXPECT_FALSE(output_surface_.context_provider()); 207 EXPECT_FALSE(output_surface_.context_provider());
206 } 208 }
207 209
208 TEST_F(OutputSurfaceTestInitializeNewContext3d, Context3dMakeCurrentFails) { 210 TEST_F(OutputSurfaceTestInitializeNewContext3d, Context3dMakeCurrentFails) {
209 BindOutputSurface(); 211 BindOutputSurface();
210 212
211 context_provider_->UnboundTestContext3d()->set_context_lost(true); 213 context_provider_->UnboundTestContext3d()->set_context_lost(true);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); 464 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count());
463 EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); 465 EXPECT_EQ(0, software_output_device->discard_backbuffer_count());
464 output_surface.DiscardBackbuffer(); 466 output_surface.DiscardBackbuffer();
465 467
466 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); 468 EXPECT_EQ(1, software_output_device->ensure_backbuffer_count());
467 EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); 469 EXPECT_EQ(1, software_output_device->discard_backbuffer_count());
468 } 470 }
469 471
470 } // namespace 472 } // namespace
471 } // namespace cc 473 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698