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

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

Issue 13051003: cpplint.py pass on cc/(base|debug|quads|resources)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix prioritized_resource_unittest Created 7 years, 9 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/resources/resource_provider.cc ('k') | cc/resources/resource_update.h » ('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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "cc/base/scoped_ptr_deque.h" 11 #include "cc/base/scoped_ptr_deque.h"
10 #include "cc/base/scoped_ptr_hash_map.h" 12 #include "cc/base/scoped_ptr_hash_map.h"
11 #include "cc/output/output_surface.h" 13 #include "cc/output/output_surface.h"
12 #include "cc/test/fake_output_surface.h" 14 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/test_web_graphics_context_3d.h" 15 #include "cc/test/test_web_graphics_context_3d.h"
14 #include "gpu/GLES2/gl2extchromium.h" 16 #include "gpu/GLES2/gl2extchromium.h"
15 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
18 #include "third_party/khronos/GLES2/gl2.h" 20 #include "third_party/khronos/GLES2/gl2.h"
19 #include "third_party/khronos/GLES2/gl2ext.h" 21 #include "third_party/khronos/GLES2/gl2ext.h"
20 #include "ui/gfx/rect.h" 22 #include "ui/gfx/rect.h"
21 23
22 using namespace WebKit;
23
24 using testing::Mock; 24 using testing::Mock;
25 using testing::NiceMock; 25 using testing::NiceMock;
26 using testing::Return; 26 using testing::Return;
27 using testing::StrictMock; 27 using testing::StrictMock;
28 using testing::_; 28 using testing::_;
29 using WebKit::WGC3Dbyte;
30 using WebKit::WGC3Denum;
31 using WebKit::WGC3Dint;
32 using WebKit::WGC3Dsizei;
33 using WebKit::WGC3Duint;
34 using WebKit::WebGLId;
29 35
30 namespace cc { 36 namespace cc {
31 namespace { 37 namespace {
32 38
33 size_t TextureSize(gfx::Size size, WGC3Denum format) { 39 size_t TextureSize(gfx::Size size, WGC3Denum format) {
34 unsigned int components_per_pixel = 4; 40 unsigned int components_per_pixel = 4;
35 unsigned int bytes_per_component = 1; 41 unsigned int bytes_per_component = 1;
36 return size.width() * size.height() * components_per_pixel * 42 return size.width() * size.height() * components_per_pixel *
37 bytes_per_component; 43 bytes_per_component;
38 } 44 }
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 scoped_ptr<Texture> texture; 322 scoped_ptr<Texture> texture;
317 }; 323 };
318 typedef ScopedPtrDeque<PendingProduceTexture> PendingProduceTextureList; 324 typedef ScopedPtrDeque<PendingProduceTexture> PendingProduceTextureList;
319 ContextSharedData* shared_data_; 325 ContextSharedData* shared_data_;
320 WebGLId current_texture_; 326 WebGLId current_texture_;
321 TextureMap textures_; 327 TextureMap textures_;
322 unsigned last_waited_sync_point_; 328 unsigned last_waited_sync_point_;
323 PendingProduceTextureList pending_produce_textures_; 329 PendingProduceTextureList pending_produce_textures_;
324 }; 330 };
325 331
326 class ResourceProviderTest : 332 class ResourceProviderTest
327 public testing::TestWithParam<ResourceProvider::ResourceType> { 333 : public testing::TestWithParam<ResourceProvider::ResourceType> {
328 public: 334 public:
329 ResourceProviderTest() 335 ResourceProviderTest()
330 : shared_data_(ContextSharedData::Create()), 336 : shared_data_(ContextSharedData::Create()),
331 output_surface_(FakeOutputSurface::Create3d( 337 output_surface_(FakeOutputSurface::Create3d(
332 ResourceProviderContext::Create(shared_data_.get()) 338 ResourceProviderContext::Create(shared_data_.get())
333 .PassAs<WebKit::WebGraphicsContext3D>())), 339 .PassAs<WebKit::WebGraphicsContext3D>())),
334 resource_provider_(ResourceProvider::Create(output_surface_.get())) { 340 resource_provider_(ResourceProvider::Create(output_surface_.get())) {
335 resource_provider_->set_default_resource_type(GetParam()); 341 resource_provider_->set_default_resource_type(GetParam());
336 } 342 }
337 343
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 Mock::VerifyAndClearExpectations(context); 1149 Mock::VerifyAndClearExpectations(context);
1144 } 1150 }
1145 1151
1146 INSTANTIATE_TEST_CASE_P( 1152 INSTANTIATE_TEST_CASE_P(
1147 ResourceProviderTests, 1153 ResourceProviderTests,
1148 ResourceProviderTest, 1154 ResourceProviderTest,
1149 ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap)); 1155 ::testing::Values(ResourceProvider::GLTexture, ResourceProvider::Bitmap));
1150 1156
1151 } // namespace 1157 } // namespace
1152 } // namespace cc 1158 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/resource_update.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698