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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 | 8 |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { | 1000 TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { |
1001 // Pick a test scale that moves the scrollbar's (non-zero) position to | 1001 // Pick a test scale that moves the scrollbar's (non-zero) position to |
1002 // a non-pixel-aligned location. | 1002 // a non-pixel-aligned location. |
1003 TestResourceUpload(.041f); | 1003 TestResourceUpload(.041f); |
1004 TestResourceUpload(1.41f); | 1004 TestResourceUpload(1.41f); |
1005 TestResourceUpload(4.1f); | 1005 TestResourceUpload(4.1f); |
1006 | 1006 |
1007 // Try something extreme to be larger than max texture size, and make it a | 1007 // Try something extreme to be larger than max texture size, and make it a |
1008 // non-integer for funsies. | 1008 // non-integer for funsies. |
1009 scoped_refptr<TestContextProvider> context = TestContextProvider::Create(); | 1009 scoped_refptr<TestContextProvider> context = TestContextProvider::Create(); |
| 1010 // Keep the max texture size reasonable so we don't OOM on low end devices |
| 1011 // (crbug.com/642333). |
| 1012 context->UnboundTestContext3d()->set_max_texture_size(512); |
1010 context->BindToCurrentThread(); | 1013 context->BindToCurrentThread(); |
1011 int max_texture_size = 0; | 1014 int max_texture_size = 0; |
1012 context->ContextGL()->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); | 1015 context->ContextGL()->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); |
| 1016 EXPECT_EQ(512, max_texture_size); |
1013 TestResourceUpload(max_texture_size / 9.9f); | 1017 TestResourceUpload(max_texture_size / 9.9f); |
1014 } | 1018 } |
1015 | 1019 |
1016 class ScaledScrollbarLayerTestScaledRasterization : public ScrollbarLayerTest { | 1020 class ScaledScrollbarLayerTestScaledRasterization : public ScrollbarLayerTest { |
1017 public: | 1021 public: |
1018 void TestScale(const gfx::Rect scrollbar_rect, const float test_scale) { | 1022 void TestScale(const gfx::Rect scrollbar_rect, const float test_scale) { |
1019 bool paint_during_update = true; | 1023 bool paint_during_update = true; |
1020 bool has_thumb = false; | 1024 bool has_thumb = false; |
1021 scoped_refptr<Layer> layer_tree_root = Layer::Create(); | 1025 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
1022 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = | 1026 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1089 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1086 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1090 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1087 | 1091 |
1088 // Horizontal Scrollbars. | 1092 // Horizontal Scrollbars. |
1089 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1093 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1090 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1094 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1091 } | 1095 } |
1092 | 1096 |
1093 } // namespace | 1097 } // namespace |
1094 } // namespace cc | 1098 } // namespace cc |
OLD | NEW |