OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |