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

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

Issue 61553006: Rename WebKit namespace to blink (part 5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/resources/resource_provider.cc ('k') | cc/resources/resource_update_controller_unittest.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 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 16 matching lines...) Expand all
27 #include "third_party/khronos/GLES2/gl2.h" 27 #include "third_party/khronos/GLES2/gl2.h"
28 #include "third_party/khronos/GLES2/gl2ext.h" 28 #include "third_party/khronos/GLES2/gl2ext.h"
29 #include "ui/gfx/rect.h" 29 #include "ui/gfx/rect.h"
30 30
31 using testing::Mock; 31 using testing::Mock;
32 using testing::NiceMock; 32 using testing::NiceMock;
33 using testing::Return; 33 using testing::Return;
34 using testing::SetArgPointee; 34 using testing::SetArgPointee;
35 using testing::StrictMock; 35 using testing::StrictMock;
36 using testing::_; 36 using testing::_;
37 using WebKit::WGC3Dbyte; 37 using blink::WGC3Dbyte;
38 using WebKit::WGC3Denum; 38 using blink::WGC3Denum;
39 using WebKit::WGC3Dint; 39 using blink::WGC3Dint;
40 using WebKit::WGC3Dsizei; 40 using blink::WGC3Dsizei;
41 using WebKit::WGC3Duint; 41 using blink::WGC3Duint;
42 using WebKit::WebGLId; 42 using blink::WebGLId;
43 43
44 namespace cc { 44 namespace cc {
45 namespace { 45 namespace {
46 46
47 static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {} 47 static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {}
48 48
49 static void SharedMemoryReleaseCallback(scoped_ptr<base::SharedMemory> memory, 49 static void SharedMemoryReleaseCallback(scoped_ptr<base::SharedMemory> memory,
50 unsigned sync_point, 50 unsigned sync_point,
51 bool lost_resource) {} 51 bool lost_resource) {}
52 52
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void(WGC3Denum target, WGC3Denum pname, WGC3Dint param)); 88 void(WGC3Denum target, WGC3Denum pname, WGC3Dint param));
89 MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point)); 89 MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point));
90 MOCK_METHOD0(insertSyncPoint, unsigned(void)); 90 MOCK_METHOD0(insertSyncPoint, unsigned(void));
91 MOCK_METHOD2(produceTextureCHROMIUM, void(WGC3Denum target, 91 MOCK_METHOD2(produceTextureCHROMIUM, void(WGC3Denum target,
92 const WGC3Dbyte* mailbox)); 92 const WGC3Dbyte* mailbox));
93 MOCK_METHOD2(consumeTextureCHROMIUM, void(WGC3Denum target, 93 MOCK_METHOD2(consumeTextureCHROMIUM, void(WGC3Denum target,
94 const WGC3Dbyte* mailbox)); 94 const WGC3Dbyte* mailbox));
95 95
96 // Force all textures to be consecutive numbers starting at "1", 96 // Force all textures to be consecutive numbers starting at "1",
97 // so we easily can test for them. 97 // so we easily can test for them.
98 virtual WebKit::WebGLId NextTextureId() OVERRIDE { 98 virtual blink::WebGLId NextTextureId() OVERRIDE {
99 base::AutoLock lock(namespace_->lock); 99 base::AutoLock lock(namespace_->lock);
100 return namespace_->next_texture_id++; 100 return namespace_->next_texture_id++;
101 } 101 }
102 virtual void RetireTextureId(WebKit::WebGLId) OVERRIDE { 102 virtual void RetireTextureId(blink::WebGLId) OVERRIDE {
103 } 103 }
104 }; 104 };
105 105
106 // Shared data between multiple ResourceProviderContext. This contains mailbox 106 // Shared data between multiple ResourceProviderContext. This contains mailbox
107 // contents as well as information about sync points. 107 // contents as well as information about sync points.
108 class ContextSharedData { 108 class ContextSharedData {
109 public: 109 public:
110 static scoped_ptr<ContextSharedData> Create() { 110 static scoped_ptr<ContextSharedData> Create() {
111 return make_scoped_ptr(new ContextSharedData()); 111 return make_scoped_ptr(new ContextSharedData());
112 } 112 }
(...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 resource_provider->DeleteResource(id); 2937 resource_provider->DeleteResource(id);
2938 } 2938 }
2939 2939
2940 INSTANTIATE_TEST_CASE_P( 2940 INSTANTIATE_TEST_CASE_P(
2941 ResourceProviderTests, 2941 ResourceProviderTests,
2942 ResourceProviderTest, 2942 ResourceProviderTest,
2943 ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap)); 2943 ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap));
2944 2944
2945 class TextureIdAllocationTrackingContext : public TestWebGraphicsContext3D { 2945 class TextureIdAllocationTrackingContext : public TestWebGraphicsContext3D {
2946 public: 2946 public:
2947 virtual WebKit::WebGLId NextTextureId() OVERRIDE { 2947 virtual blink::WebGLId NextTextureId() OVERRIDE {
2948 base::AutoLock lock(namespace_->lock); 2948 base::AutoLock lock(namespace_->lock);
2949 return namespace_->next_texture_id++; 2949 return namespace_->next_texture_id++;
2950 } 2950 }
2951 virtual void RetireTextureId(WebKit::WebGLId) OVERRIDE { 2951 virtual void RetireTextureId(blink::WebGLId) OVERRIDE {
2952 } 2952 }
2953 WebKit::WebGLId PeekTextureId() { 2953 blink::WebGLId PeekTextureId() {
2954 base::AutoLock lock(namespace_->lock); 2954 base::AutoLock lock(namespace_->lock);
2955 return namespace_->next_texture_id; 2955 return namespace_->next_texture_id;
2956 } 2956 }
2957 }; 2957 };
2958 2958
2959 TEST(ResourceProviderTest, TextureAllocationChunkSize) { 2959 TEST(ResourceProviderTest, TextureAllocationChunkSize) {
2960 scoped_ptr<TextureIdAllocationTrackingContext> context_owned( 2960 scoped_ptr<TextureIdAllocationTrackingContext> context_owned(
2961 new TextureIdAllocationTrackingContext); 2961 new TextureIdAllocationTrackingContext);
2962 TextureIdAllocationTrackingContext* context = context_owned.get(); 2962 TextureIdAllocationTrackingContext* context = context_owned.get();
2963 2963
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 resource_provider->AllocateForTesting(id); 3001 resource_provider->AllocateForTesting(id);
3002 Mock::VerifyAndClearExpectations(context); 3002 Mock::VerifyAndClearExpectations(context);
3003 3003
3004 DCHECK_EQ(10u, context->PeekTextureId()); 3004 DCHECK_EQ(10u, context->PeekTextureId());
3005 resource_provider->DeleteResource(id); 3005 resource_provider->DeleteResource(id);
3006 } 3006 }
3007 } 3007 }
3008 3008
3009 } // namespace 3009 } // namespace
3010 } // namespace cc 3010 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_update_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698