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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
9 #include "cc/layers/heads_up_display_layer.h" | 9 #include "cc/layers/heads_up_display_layer.h" |
10 #include "cc/layers/io_surface_layer.h" | 10 #include "cc/layers/io_surface_layer.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ++times_to_expect_recreate_retried_; | 206 ++times_to_expect_recreate_retried_; |
207 } | 207 } |
208 | 208 |
209 protected: | 209 protected: |
210 TestWebGraphicsContext3D* context3d_; | 210 TestWebGraphicsContext3D* context3d_; |
211 int times_to_fail_create_; | 211 int times_to_fail_create_; |
212 int times_to_fail_initialize_; | 212 int times_to_fail_initialize_; |
213 int times_to_lose_on_create_; | 213 int times_to_lose_on_create_; |
214 int times_to_lose_during_commit_; | 214 int times_to_lose_during_commit_; |
215 int times_to_lose_during_draw_; | 215 int times_to_lose_during_draw_; |
| 216 int times_to_fail_recreate_; |
216 int times_to_fail_reinitialize_; | 217 int times_to_fail_reinitialize_; |
217 int times_to_fail_recreate_; | |
218 int times_to_lose_on_recreate_; | 218 int times_to_lose_on_recreate_; |
219 int times_to_fail_create_offscreen_; | 219 int times_to_fail_create_offscreen_; |
220 int times_to_fail_recreate_offscreen_; | 220 int times_to_fail_recreate_offscreen_; |
221 int times_to_expect_recreate_retried_; | 221 int times_to_expect_recreate_retried_; |
222 int times_recreate_retried_; | 222 int times_recreate_retried_; |
223 int times_offscreen_created_; | 223 int times_offscreen_created_; |
224 bool committed_at_least_once_; | 224 bool committed_at_least_once_; |
225 | 225 |
226 scoped_refptr<FakeContextProvider> offscreen_contexts_main_thread_; | 226 scoped_refptr<FakeContextProvider> offscreen_contexts_main_thread_; |
227 scoped_refptr<FakeContextProvider> offscreen_contexts_compositor_thread_; | 227 scoped_refptr<FakeContextProvider> offscreen_contexts_compositor_thread_; |
(...skipping 13 matching lines...) Expand all Loading... |
241 PostSetNeedsCommitToMainThread(); | 241 PostSetNeedsCommitToMainThread(); |
242 } | 242 } |
243 | 243 |
244 virtual void DidRecreateOutputSurface(bool succeeded) OVERRIDE { | 244 virtual void DidRecreateOutputSurface(bool succeeded) OVERRIDE { |
245 EXPECT_TRUE(succeeded); | 245 EXPECT_TRUE(succeeded); |
246 ++num_losses_; | 246 ++num_losses_; |
247 recovered_context_ = true; | 247 recovered_context_ = true; |
248 } | 248 } |
249 | 249 |
250 virtual void AfterTest() OVERRIDE { | 250 virtual void AfterTest() OVERRIDE { |
251 EXPECT_EQ(10, test_case_); | 251 EXPECT_EQ(10u, test_case_); |
252 EXPECT_EQ(8 + 10 + 10, num_losses_); | 252 EXPECT_EQ(8 + 10 + 10, num_losses_); |
253 } | 253 } |
254 | 254 |
255 virtual void DidCommitAndDrawFrame() OVERRIDE { | 255 virtual void DidCommitAndDrawFrame() OVERRIDE { |
256 // If the last frame had a context loss, then we'll commit again to | 256 // If the last frame had a context loss, then we'll commit again to |
257 // recover. | 257 // recover. |
258 if (!recovered_context_) | 258 if (!recovered_context_) |
259 return; | 259 return; |
260 if (times_to_lose_during_commit_) | 260 if (times_to_lose_during_commit_) |
261 return; | 261 return; |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 LayerTreeHostContextTest::CommitCompleteOnThread(impl); | 1205 LayerTreeHostContextTest::CommitCompleteOnThread(impl); |
1206 | 1206 |
1207 ++commits_; | 1207 ++commits_; |
1208 size_t upload_count = scrollbar_layer_->last_update_full_upload_size() + | 1208 size_t upload_count = scrollbar_layer_->last_update_full_upload_size() + |
1209 scrollbar_layer_->last_update_partial_upload_size(); | 1209 scrollbar_layer_->last_update_partial_upload_size(); |
1210 switch(commits_) { | 1210 switch(commits_) { |
1211 case 1: | 1211 case 1: |
1212 // First (regular) update, we should upload 2 resources (thumb, and | 1212 // First (regular) update, we should upload 2 resources (thumb, and |
1213 // backtrack). | 1213 // backtrack). |
1214 EXPECT_EQ(1, scrollbar_layer_->update_count()); | 1214 EXPECT_EQ(1, scrollbar_layer_->update_count()); |
1215 EXPECT_EQ(2, upload_count); | 1215 EXPECT_EQ(2u, upload_count); |
1216 LoseContext(); | 1216 LoseContext(); |
1217 break; | 1217 break; |
1218 case 2: | 1218 case 2: |
1219 // Second update, after the lost context, we should still upload 2 | 1219 // Second update, after the lost context, we should still upload 2 |
1220 // resources even if the contents haven't changed. | 1220 // resources even if the contents haven't changed. |
1221 EXPECT_EQ(2, scrollbar_layer_->update_count()); | 1221 EXPECT_EQ(2, scrollbar_layer_->update_count()); |
1222 EXPECT_EQ(2, upload_count); | 1222 EXPECT_EQ(2u, upload_count); |
1223 EndTest(); | 1223 EndTest(); |
1224 break; | 1224 break; |
1225 default: | 1225 default: |
1226 NOTREACHED(); | 1226 NOTREACHED(); |
1227 } | 1227 } |
1228 } | 1228 } |
1229 | 1229 |
1230 private: | 1230 private: |
1231 int commits_; | 1231 int commits_; |
1232 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; | 1232 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; |
1233 }; | 1233 }; |
1234 | 1234 |
1235 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext); | 1235 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext); |
1236 | 1236 |
1237 } // namespace | 1237 } // namespace |
1238 } // namespace cc | 1238 } // namespace cc |
OLD | NEW |