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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "cc/debug/test_web_graphics_context_3d.h" | 10 #include "cc/debug/test_web_graphics_context_3d.h" |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 EndTest(); | 543 EndTest(); |
544 break; | 544 break; |
545 default: | 545 default: |
546 NOTREACHED(); | 546 NOTREACHED(); |
547 break; | 547 break; |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
551 virtual void AfterTest() OVERRIDE {} | 551 virtual void AfterTest() OVERRIDE {} |
552 | 552 |
| 553 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 554 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
| 555 } |
| 556 |
553 private: | 557 private: |
554 int callback_count_; | 558 int callback_count_; |
555 int commit_count_; | 559 int commit_count_; |
556 scoped_refptr<Layer> root_; | 560 scoped_refptr<Layer> root_; |
557 scoped_refptr<TextureLayer> layer_; | 561 scoped_refptr<TextureLayer> layer_; |
558 }; | 562 }; |
559 | 563 |
560 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 564 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
561 TextureLayerImplWithMailboxThreadedCallback); | 565 TextureLayerImplWithMailboxThreadedCallback); |
562 | 566 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 } | 888 } |
885 | 889 |
886 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | 890 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
887 bool result) OVERRIDE { | 891 bool result) OVERRIDE { |
888 ASSERT_TRUE(result); | 892 ASSERT_TRUE(result); |
889 EXPECT_EQ(expected_used_textures_on_draw_, context_->NumUsedTextures()); | 893 EXPECT_EQ(expected_used_textures_on_draw_, context_->NumUsedTextures()); |
890 } | 894 } |
891 | 895 |
892 virtual void AfterTest() OVERRIDE {} | 896 virtual void AfterTest() OVERRIDE {} |
893 | 897 |
| 898 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 899 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
| 900 } |
| 901 |
894 private: | 902 private: |
895 scoped_refptr<TextureLayer> texture_layer_; | 903 scoped_refptr<TextureLayer> texture_layer_; |
896 TestWebGraphicsContext3D* context_; | 904 TestWebGraphicsContext3D* context_; |
897 unsigned texture_; | 905 unsigned texture_; |
898 int commit_count_; | 906 int commit_count_; |
899 | 907 |
900 // Used only on thread. | 908 // Used only on thread. |
901 unsigned expected_used_textures_on_draw_; | 909 unsigned expected_used_textures_on_draw_; |
902 | 910 |
903 // Used on either thread, protected by lock_. | 911 // Used on either thread, protected by lock_. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 EXPECT_EQ(texture_, texture_layer->texture_id()); | 980 EXPECT_EQ(texture_, texture_layer->texture_id()); |
973 return true; | 981 return true; |
974 } | 982 } |
975 | 983 |
976 virtual void DidCommitAndDrawFrame() OVERRIDE { | 984 virtual void DidCommitAndDrawFrame() OVERRIDE { |
977 EndTest(); | 985 EndTest(); |
978 } | 986 } |
979 | 987 |
980 virtual void AfterTest() OVERRIDE {} | 988 virtual void AfterTest() OVERRIDE {} |
981 | 989 |
| 990 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 991 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
| 992 } |
| 993 |
982 private: | 994 private: |
983 scoped_refptr<TextureLayer> texture_layer_; | 995 scoped_refptr<TextureLayer> texture_layer_; |
984 scoped_ptr<TestWebGraphicsContext3D> texture_context_; | 996 scoped_ptr<TestWebGraphicsContext3D> texture_context_; |
985 unsigned texture_; | 997 unsigned texture_; |
986 int draw_count_; | 998 int draw_count_; |
987 }; | 999 }; |
988 | 1000 |
989 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); | 1001 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); |
990 | 1002 |
991 class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { | 1003 class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 layer_->RemoveFromParent(); | 1052 layer_->RemoveFromParent(); |
1041 layer_ = NULL; | 1053 layer_ = NULL; |
1042 break; | 1054 break; |
1043 } | 1055 } |
1044 } | 1056 } |
1045 | 1057 |
1046 virtual void AfterTest() OVERRIDE { | 1058 virtual void AfterTest() OVERRIDE { |
1047 EXPECT_EQ(1, callback_count_); | 1059 EXPECT_EQ(1, callback_count_); |
1048 } | 1060 } |
1049 | 1061 |
| 1062 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 1063 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
| 1064 } |
| 1065 |
1050 private: | 1066 private: |
1051 int callback_count_; | 1067 int callback_count_; |
1052 scoped_refptr<Layer> root_; | 1068 scoped_refptr<Layer> root_; |
1053 scoped_refptr<TextureLayer> layer_; | 1069 scoped_refptr<TextureLayer> layer_; |
1054 }; | 1070 }; |
1055 | 1071 |
1056 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1072 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1057 TextureLayerWithMailboxMainThreadDeleted); | 1073 TextureLayerWithMailboxMainThreadDeleted); |
1058 | 1074 |
1059 class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { | 1075 class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 case 2: | 1127 case 2: |
1112 layer_ = NULL; | 1128 layer_ = NULL; |
1113 break; | 1129 break; |
1114 } | 1130 } |
1115 } | 1131 } |
1116 | 1132 |
1117 virtual void AfterTest() OVERRIDE { | 1133 virtual void AfterTest() OVERRIDE { |
1118 EXPECT_EQ(1, callback_count_); | 1134 EXPECT_EQ(1, callback_count_); |
1119 } | 1135 } |
1120 | 1136 |
| 1137 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 1138 settings->max_bytes_pending_upload = 16 * 1024 * 1024; |
| 1139 } |
| 1140 |
1121 private: | 1141 private: |
1122 int callback_count_; | 1142 int callback_count_; |
1123 scoped_refptr<Layer> root_; | 1143 scoped_refptr<Layer> root_; |
1124 scoped_refptr<TextureLayer> layer_; | 1144 scoped_refptr<TextureLayer> layer_; |
1125 }; | 1145 }; |
1126 | 1146 |
1127 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1147 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
1128 TextureLayerWithMailboxImplThreadDeleted); | 1148 TextureLayerWithMailboxImplThreadDeleted); |
1129 | 1149 |
1130 } // namespace | 1150 } // namespace |
1131 } // namespace cc | 1151 } // namespace cc |
OLD | NEW |