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

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 578843002: cc: Return a NullCanvas instead of NULL in context lost situations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update unit test Created 6 years, 3 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 | « cc/resources/resource_provider.cc ('k') | cc/resources/tile_manager.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after
3316 3316
3317 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); 3317 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id));
3318 3318
3319 id = resource_provider->CreateResource( 3319 id = resource_provider->CreateResource(
3320 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); 3320 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
3321 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 3321 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
3322 GL_INNOCENT_CONTEXT_RESET_ARB); 3322 GL_INNOCENT_CONTEXT_RESET_ARB);
3323 3323
3324 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); 3324 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id);
3325 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); 3325 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas();
3326 EXPECT_TRUE(canvas.get() == NULL); 3326 EXPECT_TRUE(canvas);
3327 raster_buffer->ReleaseSkCanvas(canvas); 3327 raster_buffer->ReleaseSkCanvas(canvas);
3328 canvas.clear();
3329 resource_provider->ReleasePixelRasterBuffer(id); 3328 resource_provider->ReleasePixelRasterBuffer(id);
3330 Mock::VerifyAndClearExpectations(context); 3329 Mock::VerifyAndClearExpectations(context);
3331 } 3330 }
3332 3331
3333 TEST_P(ResourceProviderTest, Image_GLTexture) { 3332 TEST_P(ResourceProviderTest, Image_GLTexture) {
3334 // Only for GL textures. 3333 // Only for GL textures.
3335 if (GetParam() != ResourceProvider::GLTexture) 3334 if (GetParam() != ResourceProvider::GLTexture)
3336 return; 3335 return;
3337 scoped_ptr<AllocationTrackingContext3D> context_owned( 3336 scoped_ptr<AllocationTrackingContext3D> context_owned(
3338 new StrictMock<AllocationTrackingContext3D>); 3337 new StrictMock<AllocationTrackingContext3D>);
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
3818 resource_provider->AllocateForTesting(id); 3817 resource_provider->AllocateForTesting(id);
3819 Mock::VerifyAndClearExpectations(context); 3818 Mock::VerifyAndClearExpectations(context);
3820 3819
3821 DCHECK_EQ(10u, context->PeekTextureId()); 3820 DCHECK_EQ(10u, context->PeekTextureId());
3822 resource_provider->DeleteResource(id); 3821 resource_provider->DeleteResource(id);
3823 } 3822 }
3824 } 3823 }
3825 3824
3826 } // namespace 3825 } // namespace
3827 } // namespace cc 3826 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698