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/resource_provider.h" | 5 #include "cc/resource_provider.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/output_surface.h" | 8 #include "cc/output_surface.h" |
9 #include "cc/scoped_ptr_deque.h" | 9 #include "cc/scoped_ptr_deque.h" |
10 #include "cc/scoped_ptr_hash_map.h" | 10 #include "cc/scoped_ptr_hash_map.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 EXPECT_EQ(1u, list.resources.size()); | 556 EXPECT_EQ(1u, list.resources.size()); |
557 childResourceProvider->receiveFromParent(list); | 557 childResourceProvider->receiveFromParent(list); |
558 } | 558 } |
559 EXPECT_EQ(0u, childResourceProvider->numResources()); | 559 EXPECT_EQ(0u, childResourceProvider->numResources()); |
560 } | 560 } |
561 | 561 |
562 class TextureStateTrackingContext : public FakeWebGraphicsContext3D { | 562 class TextureStateTrackingContext : public FakeWebGraphicsContext3D { |
563 public: | 563 public: |
564 MOCK_METHOD2(bindTexture, void(WGC3Denum target, WebGLId texture)); | 564 MOCK_METHOD2(bindTexture, void(WGC3Denum target, WebGLId texture)); |
565 MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint
param)); | 565 MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint
param)); |
| 566 |
| 567 // Force all textures to be "1" so we can test for them. |
| 568 virtual WebKit::WebGLId NextTextureId() { return 1; } |
566 }; | 569 }; |
567 | 570 |
568 TEST_P(ResourceProviderTest, ScopedSampler) | 571 TEST_P(ResourceProviderTest, ScopedSampler) |
569 { | 572 { |
570 // Sampling is only supported for GL textures. | 573 // Sampling is only supported for GL textures. |
571 if (GetParam() != ResourceProvider::GLTexture) | 574 if (GetParam() != ResourceProvider::GLTexture) |
572 return; | 575 return; |
573 | 576 |
574 scoped_ptr<OutputSurface> outputSurface(FakeOutputSurface::Create3d(scoped_p
tr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))); | 577 scoped_ptr<OutputSurface> outputSurface(FakeOutputSurface::Create3d(scoped_p
tr<WebKit::WebGraphicsContext3D>(new TextureStateTrackingContext))); |
575 TextureStateTrackingContext* context = static_cast<TextureStateTrackingConte
xt*>(outputSurface->Context3D()); | 578 TextureStateTrackingContext* context = static_cast<TextureStateTrackingConte
xt*>(outputSurface->Context3D()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 Mock::VerifyAndClearExpectations(context); | 643 Mock::VerifyAndClearExpectations(context); |
641 } | 644 } |
642 | 645 |
643 INSTANTIATE_TEST_CASE_P(ResourceProviderTests, | 646 INSTANTIATE_TEST_CASE_P(ResourceProviderTests, |
644 ResourceProviderTest, | 647 ResourceProviderTest, |
645 ::testing::Values(ResourceProvider::GLTexture, | 648 ::testing::Values(ResourceProvider::GLTexture, |
646 ResourceProvider::Bitmap)); | 649 ResourceProvider::Bitmap)); |
647 | 650 |
648 } // namespace | 651 } // namespace |
649 } // namespace cc | 652 } // namespace cc |
OLD | NEW |