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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet 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/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "cc/animation/timing_function.h" 11 #include "cc/animation/timing_function.h"
12 #include "cc/debug/frame_rate_counter.h" 12 #include "cc/debug/frame_rate_counter.h"
13 #include "cc/debug/test_web_graphics_context_3d.h"
13 #include "cc/layers/content_layer.h" 14 #include "cc/layers/content_layer.h"
14 #include "cc/layers/content_layer_client.h" 15 #include "cc/layers/content_layer_client.h"
15 #include "cc/layers/io_surface_layer.h" 16 #include "cc/layers/io_surface_layer.h"
16 #include "cc/layers/layer_impl.h" 17 #include "cc/layers/layer_impl.h"
17 #include "cc/layers/picture_layer.h" 18 #include "cc/layers/picture_layer.h"
18 #include "cc/layers/scrollbar_layer.h" 19 #include "cc/layers/scrollbar_layer.h"
19 #include "cc/layers/solid_color_layer.h" 20 #include "cc/layers/solid_color_layer.h"
20 #include "cc/layers/video_layer.h" 21 #include "cc/layers/video_layer.h"
21 #include "cc/output/begin_frame_args.h" 22 #include "cc/output/begin_frame_args.h"
22 #include "cc/output/copy_output_request.h" 23 #include "cc/output/copy_output_request.h"
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 1140
1140 virtual void BeginTest() OVERRIDE { 1141 virtual void BeginTest() OVERRIDE {
1141 drew_frame_ = -1; 1142 drew_frame_ = -1;
1142 PostSetNeedsCommitToMainThread(); 1143 PostSetNeedsCommitToMainThread();
1143 } 1144 }
1144 1145
1145 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1146 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1146 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); 1147 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
1147 1148
1148 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( 1149 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
1149 impl->output_surface()->context3d()); 1150 impl->output_surface()->context_provider()->Context3d());
1150 1151
1151 switch (impl->active_tree()->source_frame_number()) { 1152 switch (impl->active_tree()->source_frame_number()) {
1152 case 0: 1153 case 0:
1153 // Number of textures should be one for each layer 1154 // Number of textures should be one for each layer
1154 ASSERT_EQ(2u, context->NumTextures()); 1155 ASSERT_EQ(2u, context->NumTextures());
1155 // Number of textures used for commit should be one for each layer. 1156 // Number of textures used for commit should be one for each layer.
1156 EXPECT_EQ(2u, context->NumUsedTextures()); 1157 EXPECT_EQ(2u, context->NumUsedTextures());
1157 // Verify that used texture is correct. 1158 // Verify that used texture is correct.
1158 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); 1159 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0)));
1159 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); 1160 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1)));
(...skipping 21 matching lines...) Expand all
1181 EndTest(); 1182 EndTest();
1182 break; 1183 break;
1183 default: 1184 default:
1184 NOTREACHED(); 1185 NOTREACHED();
1185 break; 1186 break;
1186 } 1187 }
1187 } 1188 }
1188 1189
1189 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1190 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1190 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( 1191 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
1191 impl->output_surface()->context3d()); 1192 impl->output_surface()->context_provider()->Context3d());
1192 1193
1193 if (drew_frame_ == impl->active_tree()->source_frame_number()) { 1194 if (drew_frame_ == impl->active_tree()->source_frame_number()) {
1194 EXPECT_EQ(0u, context->NumUsedTextures()) << "For frame " << drew_frame_; 1195 EXPECT_EQ(0u, context->NumUsedTextures()) << "For frame " << drew_frame_;
1195 return; 1196 return;
1196 } 1197 }
1197 drew_frame_ = impl->active_tree()->source_frame_number(); 1198 drew_frame_ = impl->active_tree()->source_frame_number();
1198 1199
1199 // We draw/ship one texture each frame for each layer. 1200 // We draw/ship one texture each frame for each layer.
1200 EXPECT_EQ(2u, context->NumUsedTextures()); 1201 EXPECT_EQ(2u, context->NumUsedTextures());
1201 context->ResetUsedTextures(); 1202 context->ResetUsedTextures();
(...skipping 16 matching lines...) Expand all
1218 MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1219 MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1219 LayerTreeHostTestDirectRendererAtomicCommit); 1220 LayerTreeHostTestDirectRendererAtomicCommit);
1220 1221
1221 class LayerTreeHostTestDelegatingRendererAtomicCommit 1222 class LayerTreeHostTestDelegatingRendererAtomicCommit
1222 : public LayerTreeHostTestDirectRendererAtomicCommit { 1223 : public LayerTreeHostTestDirectRendererAtomicCommit {
1223 public: 1224 public:
1224 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1225 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1225 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); 1226 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
1226 1227
1227 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( 1228 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
1228 impl->output_surface()->context3d()); 1229 impl->output_surface()->context_provider()->Context3d());
1229 1230
1230 switch (impl->active_tree()->source_frame_number()) { 1231 switch (impl->active_tree()->source_frame_number()) {
1231 case 0: 1232 case 0:
1232 // Number of textures should be one for each layer 1233 // Number of textures should be one for each layer
1233 ASSERT_EQ(2u, context->NumTextures()); 1234 ASSERT_EQ(2u, context->NumTextures());
1234 // Number of textures used for commit should be one for each layer. 1235 // Number of textures used for commit should be one for each layer.
1235 EXPECT_EQ(2u, context->NumUsedTextures()); 1236 EXPECT_EQ(2u, context->NumUsedTextures());
1236 // Verify that used texture is correct. 1237 // Verify that used texture is correct.
1237 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); 1238 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0)));
1238 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); 1239 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1)));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 default: 1341 default:
1341 NOTREACHED() << layer_tree_host()->source_frame_number(); 1342 NOTREACHED() << layer_tree_host()->source_frame_number();
1342 break; 1343 break;
1343 } 1344 }
1344 } 1345 }
1345 1346
1346 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1347 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1347 ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates); 1348 ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates);
1348 1349
1349 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( 1350 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
1350 impl->output_surface()->context3d()); 1351 impl->output_surface()->context_provider()->Context3d());
1351 1352
1352 switch (impl->active_tree()->source_frame_number()) { 1353 switch (impl->active_tree()->source_frame_number()) {
1353 case 0: 1354 case 0:
1354 // Number of textures should be one for each layer. 1355 // Number of textures should be one for each layer.
1355 ASSERT_EQ(2u, context->NumTextures()); 1356 ASSERT_EQ(2u, context->NumTextures());
1356 // Number of textures used for commit should be one for each layer. 1357 // Number of textures used for commit should be one for each layer.
1357 EXPECT_EQ(2u, context->NumUsedTextures()); 1358 EXPECT_EQ(2u, context->NumUsedTextures());
1358 // Verify that used textures are correct. 1359 // Verify that used textures are correct.
1359 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0))); 1360 EXPECT_TRUE(context->UsedTexture(context->TextureAt(0)));
1360 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1))); 1361 EXPECT_TRUE(context->UsedTexture(context->TextureAt(1)));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 default: 1406 default:
1406 NOTREACHED(); 1407 NOTREACHED();
1407 break; 1408 break;
1408 } 1409 }
1409 } 1410 }
1410 1411
1411 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1412 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1412 EXPECT_LT(impl->active_tree()->source_frame_number(), 5); 1413 EXPECT_LT(impl->active_tree()->source_frame_number(), 5);
1413 1414
1414 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( 1415 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
1415 impl->output_surface()->context3d()); 1416 impl->output_surface()->context_provider()->Context3d());
1416 1417
1417 // Number of textures used for drawing should one per layer except for 1418 // Number of textures used for drawing should one per layer except for
1418 // frame 3 where the viewport only contains one layer. 1419 // frame 3 where the viewport only contains one layer.
1419 if (impl->active_tree()->source_frame_number() == 3) { 1420 if (impl->active_tree()->source_frame_number() == 3) {
1420 EXPECT_EQ(1u, context->NumUsedTextures()); 1421 EXPECT_EQ(1u, context->NumUsedTextures());
1421 } else { 1422 } else {
1422 EXPECT_EQ(2u, context->NumUsedTextures()) << 1423 EXPECT_EQ(2u, context->NumUsedTextures()) <<
1423 "For frame " << impl->active_tree()->source_frame_number(); 1424 "For frame " << impl->active_tree()->source_frame_number();
1424 } 1425 }
1425 1426
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 } 2364 }
2364 } 2365 }
2365 2366
2366 private: 2367 private:
2367 SetBoundsClient client_; 2368 SetBoundsClient client_;
2368 int num_commits_; 2369 int num_commits_;
2369 }; 2370 };
2370 2371
2371 SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents); 2372 SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents);
2372 2373
2373 class MockIOSurfaceWebGraphicsContext3D : public FakeWebGraphicsContext3D { 2374 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
2374 public: 2375 public:
2375 MockIOSurfaceWebGraphicsContext3D()
2376 : FakeWebGraphicsContext3D() {}
2377
2378 virtual WebKit::WebGLId createTexture() OVERRIDE { 2376 virtual WebKit::WebGLId createTexture() OVERRIDE {
2379 return 1; 2377 return 1;
2380 } 2378 }
2381 2379
2382 virtual WebKit::WebString getString(WebKit::WGC3Denum name) OVERRIDE {
2383 if (name == GL_EXTENSIONS) {
2384 return WebKit::WebString(
2385 "GL_CHROMIUM_iosurface GL_ARB_texture_rectangle");
2386 }
2387 return WebKit::WebString();
2388 }
2389
2390 MOCK_METHOD1(activeTexture, void(WebKit::WGC3Denum texture)); 2380 MOCK_METHOD1(activeTexture, void(WebKit::WGC3Denum texture));
2391 MOCK_METHOD2(bindTexture, void(WebKit::WGC3Denum target, 2381 MOCK_METHOD2(bindTexture, void(WebKit::WGC3Denum target,
2392 WebKit::WebGLId texture_id)); 2382 WebKit::WebGLId texture_id));
2393 MOCK_METHOD3(texParameteri, void(WebKit::WGC3Denum target, 2383 MOCK_METHOD3(texParameteri, void(WebKit::WGC3Denum target,
2394 WebKit::WGC3Denum pname, 2384 WebKit::WGC3Denum pname,
2395 WebKit::WGC3Dint param)); 2385 WebKit::WGC3Dint param));
2396 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(WebKit::WGC3Denum target, 2386 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(WebKit::WGC3Denum target,
2397 WebKit::WGC3Dint width, 2387 WebKit::WGC3Dint width,
2398 WebKit::WGC3Dint height, 2388 WebKit::WGC3Dint height,
2399 WebKit::WGC3Duint ioSurfaceId, 2389 WebKit::WGC3Duint ioSurfaceId,
2400 WebKit::WGC3Duint plane)); 2390 WebKit::WGC3Duint plane));
2401 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, 2391 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode,
2402 WebKit::WGC3Dsizei count, 2392 WebKit::WGC3Dsizei count,
2403 WebKit::WGC3Denum type, 2393 WebKit::WGC3Denum type,
2404 WebKit::WGC3Dintptr offset)); 2394 WebKit::WGC3Dintptr offset));
2395 MOCK_METHOD1(deleteTexture, void(WebKit::WGC3Denum texture));
2405 }; 2396 };
2406 2397
2407 2398
2408 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { 2399 class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
2409 protected: 2400 protected:
2410 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) 2401 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
2411 OVERRIDE { 2402 OVERRIDE {
2412 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> context( 2403 scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned(
2413 new MockIOSurfaceWebGraphicsContext3D); 2404 new MockIOSurfaceWebGraphicsContext3D);
2414 mock_context_ = context.get(); 2405 mock_context_ = mock_context_owned.get();
2415 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( 2406
2416 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); 2407 mock_context_->set_have_extension_io_surface(true);
2408
2409 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2410 mock_context_owned.PassAs<TestWebGraphicsContext3D>()));
2417 return output_surface.Pass(); 2411 return output_surface.Pass();
2418 } 2412 }
2419 2413
2420 virtual void SetupTree() OVERRIDE { 2414 virtual void SetupTree() OVERRIDE {
2421 LayerTreeHostTest::SetupTree(); 2415 LayerTreeHostTest::SetupTree();
2422 2416
2423 layer_tree_host()->root_layer()->SetIsDrawable(false); 2417 layer_tree_host()->root_layer()->SetIsDrawable(false);
2424 2418
2425 io_surface_id_ = 9; 2419 io_surface_id_ = 9;
2426 io_surface_size_ = gfx::Size(6, 7); 2420 io_surface_size_ = gfx::Size(6, 7);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1)) 2479 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1))
2486 .Times(1); 2480 .Times(1);
2487 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) 2481 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _))
2488 .Times(AtLeast(1)); 2482 .Times(AtLeast(1));
2489 2483
2490 return result; 2484 return result;
2491 } 2485 }
2492 2486
2493 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 2487 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
2494 Mock::VerifyAndClearExpectations(&mock_context_); 2488 Mock::VerifyAndClearExpectations(&mock_context_);
2489
2490 EXPECT_CALL(*mock_context_, deleteTexture(1)).Times(1);
2495 EndTest(); 2491 EndTest();
2496 } 2492 }
2497 2493
2498 virtual void AfterTest() OVERRIDE {} 2494 virtual void AfterTest() OVERRIDE {}
2499 2495
2500 int io_surface_id_; 2496 int io_surface_id_;
2501 MockIOSurfaceWebGraphicsContext3D* mock_context_; 2497 MockIOSurfaceWebGraphicsContext3D* mock_context_;
2502 gfx::Size io_surface_size_; 2498 gfx::Size io_surface_size_;
2503 }; 2499 };
2504 2500
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 gfx::Size(bitmap->width(), bitmap->height()).ToString()); 2584 gfx::Size(bitmap->width(), bitmap->height()).ToString());
2589 callbacks_.push_back(result->size()); 2585 callbacks_.push_back(result->size());
2590 } 2586 }
2591 2587
2592 virtual void AfterTest() OVERRIDE { 2588 virtual void AfterTest() OVERRIDE {
2593 EXPECT_EQ(4u, callbacks_.size()); 2589 EXPECT_EQ(4u, callbacks_.size());
2594 } 2590 }
2595 2591
2596 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) 2592 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
2597 OVERRIDE { 2593 OVERRIDE {
2598 if (use_gl_renderer_) 2594 scoped_ptr<FakeOutputSurface> output_surface;
2599 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); 2595 if (use_gl_renderer_) {
2600 return FakeOutputSurface::CreateSoftware( 2596 output_surface = FakeOutputSurface::Create3d().Pass();
2601 make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>(); 2597 } else {
2598 output_surface = FakeOutputSurface::CreateSoftware(
2599 make_scoped_ptr(new SoftwareOutputDevice)).Pass();
2600 }
2601 return output_surface.PassAs<OutputSurface>();
2602 } 2602 }
2603 2603
2604 bool use_gl_renderer_; 2604 bool use_gl_renderer_;
2605 std::vector<gfx::Size> callbacks_; 2605 std::vector<gfx::Size> callbacks_;
2606 FakeContentLayerClient client_; 2606 FakeContentLayerClient client_;
2607 scoped_refptr<FakeContentLayer> root; 2607 scoped_refptr<FakeContentLayer> root;
2608 scoped_refptr<FakeContentLayer> child; 2608 scoped_refptr<FakeContentLayer> child;
2609 }; 2609 };
2610 2610
2611 // Readback can't be done with a delegating renderer. 2611 // Readback can't be done with a delegating renderer.
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 base::Unretained(host_impl))); 3176 base::Unretained(host_impl)));
3177 } else if (did_initialize_gl_ && did_release_gl_) { 3177 } else if (did_initialize_gl_ && did_release_gl_) {
3178 EXPECT_LE(3u, layer_impl->append_quads_count()); 3178 EXPECT_LE(3u, layer_impl->append_quads_count());
3179 EndTest(); 3179 EndTest();
3180 } 3180 }
3181 } 3181 }
3182 3182
3183 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) { 3183 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) {
3184 EXPECT_FALSE(did_initialize_gl_); 3184 EXPECT_FALSE(did_initialize_gl_);
3185 // SetAndInitializeContext3D calls SetNeedsCommit. 3185 // SetAndInitializeContext3D calls SetNeedsCommit.
3186 EXPECT_TRUE(static_cast<FakeOutputSurface*>(host_impl->output_surface()) 3186 FakeOutputSurface* fake_output_surface =
3187 ->SetAndInitializeContext3D( 3187 static_cast<FakeOutputSurface*>(host_impl->output_surface());
3188 scoped_ptr<WebKit::WebGraphicsContext3D>( 3188 scoped_refptr<TestContextProvider> context_provider =
3189 TestWebGraphicsContext3D::Create()))); 3189 TestContextProvider::Create(); // Not bound to thread.
3190 EXPECT_TRUE(fake_output_surface->InitializeAndSetContext3d(
3191 context_provider, NULL));
3190 did_initialize_gl_ = true; 3192 did_initialize_gl_ = true;
3191 } 3193 }
3192 3194
3193 void ReleaseGLAndRedraw(LayerTreeHostImpl* host_impl) { 3195 void ReleaseGLAndRedraw(LayerTreeHostImpl* host_impl) {
3194 EXPECT_TRUE(did_initialize_gl_); 3196 EXPECT_TRUE(did_initialize_gl_);
3195 EXPECT_FALSE(did_release_gl_); 3197 EXPECT_FALSE(did_release_gl_);
3196 // ReleaseGL calls SetNeedsCommit. 3198 // ReleaseGL calls SetNeedsCommit.
3197 static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL(); 3199 static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL();
3198 did_release_gl_ = true; 3200 did_release_gl_ = true;
3199 } 3201 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 break; 3249 break;
3248 case 5: 3250 case 5:
3249 ClearResources(); 3251 ClearResources();
3250 EndTest(); 3252 EndTest();
3251 break; 3253 break;
3252 } 3254 }
3253 } 3255 }
3254 3256
3255 void PerformTest(LayerTreeHostImpl* impl) { 3257 void PerformTest(LayerTreeHostImpl* impl) {
3256 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( 3258 TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(
3257 impl->output_surface()->context3d()); 3259 impl->output_surface()->context_provider()->Context3d());
3258 3260
3259 int frame = num_commits_; 3261 int frame = num_commits_;
3260 switch (frame) { 3262 switch (frame) {
3261 case 1: 3263 case 1:
3262 ASSERT_EQ(0u, context->NumTextures()); 3264 ASSERT_EQ(0u, context->NumTextures());
3263 break; 3265 break;
3264 case 2: 3266 case 2:
3265 // Created two textures. 3267 // Created two textures.
3266 ASSERT_EQ(2u, context->NumTextures()); 3268 ASSERT_EQ(2u, context->NumTextures());
3267 break; 3269 break;
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
4344 int num_will_begin_frames_; 4346 int num_will_begin_frames_;
4345 int num_impl_commits_; 4347 int num_impl_commits_;
4346 }; 4348 };
4347 4349
4348 // Commits can only be aborted when using the thread proxy. 4350 // Commits can only be aborted when using the thread proxy.
4349 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); 4351 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures);
4350 4352
4351 } // namespace 4353 } // namespace
4352 4354
4353 } // namespace cc 4355 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698