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

Side by Side Diff: cc/throttled_texture_uploader_unittest.cc

Issue 11074009: cc: Remove LayerTextureUpdater::Texture::updateRect() callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 2 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/throttled_texture_uploader.cc ('k') | cc/tiled_layer.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 "config.h" 5 #include "config.h"
6 6
7 #include "ThrottledTextureUploader.h" 7 #include "ThrottledTextureUploader.h"
8 8
9 #include "CCPrioritizedTexture.h"
9 #include "Extensions3DChromium.h" 10 #include "Extensions3DChromium.h"
10 #include "FakeWebGraphicsContext3D.h" 11 #include "FakeWebGraphicsContext3D.h"
11 #include "GraphicsContext3D.h" 12 #include "GraphicsContext3D.h"
12 13
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include <wtf/RefPtr.h> 16 #include <wtf/RefPtr.h>
16 17
17 using namespace cc; 18 using namespace cc;
18 using namespace WebKit; 19 using namespace WebKit;
(...skipping 17 matching lines...) Expand all
36 break; 37 break;
37 } 38 }
38 } 39 }
39 40
40 void setResultAvailable(unsigned resultAvailable) { m_resultAvailable = resu ltAvailable; } 41 void setResultAvailable(unsigned resultAvailable) { m_resultAvailable = resu ltAvailable; }
41 42
42 private: 43 private:
43 unsigned m_resultAvailable; 44 unsigned m_resultAvailable;
44 }; 45 };
45 46
46 class FakeTexture : public cc::LayerTextureUpdater::Texture {
47 public:
48 FakeTexture() : LayerTextureUpdater::Texture(
49 CCPrioritizedTexture::create(NULL, IntSize(256,256), GL_RGBA)) {
50 }
51
52 virtual void updateRect(cc::CCResourceProvider* , const cc::IntRect&, const cc ::IntSize&) OVERRIDE { }
53
54 };
55
56 47
57 TEST(ThrottledTextureUploaderTest, NumBlockingUploads) 48 TEST(ThrottledTextureUploaderTest, NumBlockingUploads)
58 { 49 {
59 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting)); 50 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting));
60 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get()); 51 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get());
61 OwnPtr<FakeTexture> texture = adoptPtr(new FakeTexture); 52 scoped_ptr<CCPrioritizedTexture> texture =
53 CCPrioritizedTexture::create(NULL, IntSize(256, 256), GL_RGBA);
62 TextureUploader::Parameters upload; 54 TextureUploader::Parameters upload;
63 upload.texture = texture.get(); 55 upload.texture = texture.get();
64 upload.sourceRect = IntRect(IntPoint(0,0), texture->texture()->size()); 56 upload.bitmap = NULL;
65 upload.destOffset = IntSize(); 57 upload.picture = NULL;
58 upload.geometry.contentRect = IntRect(IntPoint(0,0), texture->size());
59 upload.geometry.sourceRect = IntRect(IntPoint(0,0), texture->size());
60 upload.geometry.destOffset = IntSize();
66 61
67 fakeContext->setResultAvailable(0); 62 fakeContext->setResultAvailable(0);
68 EXPECT_EQ(0, uploader->numBlockingUploads()); 63 EXPECT_EQ(0, uploader->numBlockingUploads());
69 uploader->uploadTexture(NULL, upload); 64 uploader->uploadTexture(NULL, upload);
70 EXPECT_EQ(1, uploader->numBlockingUploads()); 65 EXPECT_EQ(1, uploader->numBlockingUploads());
71 uploader->uploadTexture(NULL, upload); 66 uploader->uploadTexture(NULL, upload);
72 EXPECT_EQ(2, uploader->numBlockingUploads()); 67 EXPECT_EQ(2, uploader->numBlockingUploads());
73 68
74 fakeContext->setResultAvailable(1); 69 fakeContext->setResultAvailable(1);
75 EXPECT_EQ(0, uploader->numBlockingUploads()); 70 EXPECT_EQ(0, uploader->numBlockingUploads());
76 uploader->uploadTexture(NULL, upload); 71 uploader->uploadTexture(NULL, upload);
77 EXPECT_EQ(0, uploader->numBlockingUploads()); 72 EXPECT_EQ(0, uploader->numBlockingUploads());
78 uploader->uploadTexture(NULL, upload); 73 uploader->uploadTexture(NULL, upload);
79 uploader->uploadTexture(NULL, upload); 74 uploader->uploadTexture(NULL, upload);
80 EXPECT_EQ(0, uploader->numBlockingUploads()); 75 EXPECT_EQ(0, uploader->numBlockingUploads());
81 } 76 }
82 77
83 TEST(ThrottledTextureUploaderTest, MarkPendingUploadsAsNonBlocking) 78 TEST(ThrottledTextureUploaderTest, MarkPendingUploadsAsNonBlocking)
84 { 79 {
85 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting)); 80 OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new Fa keWebGraphicsContext3DWithQueryTesting));
86 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get()); 81 OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create (fakeContext.get());
87 OwnPtr<FakeTexture> texture = adoptPtr(new FakeTexture); 82 scoped_ptr<CCPrioritizedTexture> texture =
83 CCPrioritizedTexture::create(NULL, IntSize(256, 256), GL_RGBA);
88 TextureUploader::Parameters upload; 84 TextureUploader::Parameters upload;
89 upload.texture = texture.get(); 85 upload.texture = texture.get();
90 upload.sourceRect = IntRect(IntPoint(0,0), texture->texture()->size()); 86 upload.bitmap = NULL;
91 upload.destOffset = IntSize(); 87 upload.picture = NULL;
88 upload.geometry.contentRect = IntRect(IntPoint(0,0), texture->size());
89 upload.geometry.sourceRect = IntRect(IntPoint(0,0), texture->size());
90 upload.geometry.destOffset = IntSize();
92 91
93 fakeContext->setResultAvailable(0); 92 fakeContext->setResultAvailable(0);
94 EXPECT_EQ(0, uploader->numBlockingUploads()); 93 EXPECT_EQ(0, uploader->numBlockingUploads());
95 uploader->uploadTexture(NULL, upload); 94 uploader->uploadTexture(NULL, upload);
96 uploader->uploadTexture(NULL, upload); 95 uploader->uploadTexture(NULL, upload);
97 EXPECT_EQ(2, uploader->numBlockingUploads()); 96 EXPECT_EQ(2, uploader->numBlockingUploads());
98 97
99 uploader->markPendingUploadsAsNonBlocking(); 98 uploader->markPendingUploadsAsNonBlocking();
100 EXPECT_EQ(0, uploader->numBlockingUploads()); 99 EXPECT_EQ(0, uploader->numBlockingUploads());
101 uploader->uploadTexture(NULL, upload); 100 uploader->uploadTexture(NULL, upload);
102 EXPECT_EQ(1, uploader->numBlockingUploads()); 101 EXPECT_EQ(1, uploader->numBlockingUploads());
103 102
104 fakeContext->setResultAvailable(1); 103 fakeContext->setResultAvailable(1);
105 EXPECT_EQ(0, uploader->numBlockingUploads()); 104 EXPECT_EQ(0, uploader->numBlockingUploads());
106 uploader->uploadTexture(NULL, upload); 105 uploader->uploadTexture(NULL, upload);
107 uploader->markPendingUploadsAsNonBlocking(); 106 uploader->markPendingUploadsAsNonBlocking();
108 EXPECT_EQ(0, uploader->numBlockingUploads()); 107 EXPECT_EQ(0, uploader->numBlockingUploads());
109 } 108 }
110 109
111 } // namespace 110 } // namespace
OLDNEW
« no previous file with comments | « cc/throttled_texture_uploader.cc ('k') | cc/tiled_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698