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/delegated_frame_provider.h" | 9 #include "cc/layers/delegated_frame_provider.h" |
10 #include "cc/layers/delegated_frame_resource_collection.h" | 10 #include "cc/layers/delegated_frame_resource_collection.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 virtual void DidInitializeOutputSurface() OVERRIDE { EXPECT_TRUE(false); } | 308 virtual void DidInitializeOutputSurface() OVERRIDE { EXPECT_TRUE(false); } |
309 | 309 |
310 virtual void AfterTest() OVERRIDE { | 310 virtual void AfterTest() OVERRIDE { |
311 } | 311 } |
312 }; | 312 }; |
313 | 313 |
314 SINGLE_AND_MULTI_THREAD_TEST_F( | 314 SINGLE_AND_MULTI_THREAD_TEST_F( |
315 LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); | 315 LayerTreeHostClientNotReadyDoesNotCreateOutputSurface); |
316 | 316 |
| 317 class LayerTreeHostClientFinishedDoesNotCreateOutputSurface |
| 318 : public LayerTreeHostContextTest { |
| 319 public: |
| 320 LayerTreeHostClientFinishedDoesNotCreateOutputSurface() |
| 321 : LayerTreeHostContextTest() {} |
| 322 |
| 323 virtual void WillBeginTest() OVERRIDE { |
| 324 layer_tree_host()->SetLayerTreeHostClientReady(); |
| 325 layer_tree_host()->SetLayerTreeHostClientFinished(); |
| 326 } |
| 327 |
| 328 virtual void BeginTest() OVERRIDE { |
| 329 PostSetNeedsCommitToMainThread(); |
| 330 EndTest(); |
| 331 } |
| 332 |
| 333 virtual scoped_ptr<OutputSurface> CreateOutputSurface( |
| 334 bool fallback) OVERRIDE { |
| 335 EXPECT_TRUE(false); |
| 336 return scoped_ptr<OutputSurface>(); |
| 337 } |
| 338 |
| 339 virtual void DidInitializeOutputSurface() OVERRIDE { EXPECT_TRUE(false); } |
| 340 |
| 341 virtual void AfterTest() OVERRIDE {} |
| 342 }; |
| 343 |
| 344 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 345 LayerTreeHostClientFinishedDoesNotCreateOutputSurface); |
| 346 |
| 347 class LayerTreeHostClientFinishedDoesNotCreateSecondSurface |
| 348 : public LayerTreeHostContextTest { |
| 349 public: |
| 350 LayerTreeHostClientFinishedDoesNotCreateSecondSurface() |
| 351 : LayerTreeHostContextTest(), attempted_create_output_surface_(false) {} |
| 352 |
| 353 virtual void WillBeginTest() OVERRIDE { |
| 354 layer_tree_host()->SetLayerTreeHostClientReady(); |
| 355 } |
| 356 |
| 357 virtual void BeginTest() OVERRIDE { |
| 358 PostSetNeedsCommitToMainThread(); |
| 359 EndTest(); |
| 360 } |
| 361 |
| 362 virtual scoped_ptr<OutputSurface> CreateOutputSurface( |
| 363 bool fallback) OVERRIDE { |
| 364 EXPECT_FALSE(attempted_create_output_surface_); |
| 365 layer_tree_host()->SetLayerTreeHostClientFinished(); |
| 366 ExpectCreateToFail(); |
| 367 attempted_create_output_surface_ = true; |
| 368 // Returning null here will post another task to create another surface. |
| 369 // However, because the LTH client is finished it should never call this |
| 370 // again. |
| 371 PostSetNeedsCommitToMainThread(); |
| 372 return scoped_ptr<OutputSurface>(); |
| 373 } |
| 374 |
| 375 virtual void DidInitializeOutputSurface() OVERRIDE { EXPECT_TRUE(false); } |
| 376 |
| 377 virtual void AfterTest() OVERRIDE { |
| 378 EXPECT_TRUE(attempted_create_output_surface_); |
| 379 } |
| 380 |
| 381 private: |
| 382 bool attempted_create_output_surface_; |
| 383 }; |
| 384 |
| 385 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 386 LayerTreeHostClientFinishedDoesNotCreateSecondSurface); |
| 387 |
317 class LayerTreeHostContextTestLostContextSucceedsWithContent | 388 class LayerTreeHostContextTestLostContextSucceedsWithContent |
318 : public LayerTreeHostContextTestLostContextSucceeds { | 389 : public LayerTreeHostContextTestLostContextSucceeds { |
319 public: | 390 public: |
320 virtual void SetupTree() OVERRIDE { | 391 virtual void SetupTree() OVERRIDE { |
321 root_ = Layer::Create(); | 392 root_ = Layer::Create(); |
322 root_->SetBounds(gfx::Size(10, 10)); | 393 root_->SetBounds(gfx::Size(10, 10)); |
323 root_->SetIsDrawable(true); | 394 root_->SetIsDrawable(true); |
324 | 395 |
325 content_ = FakeContentLayer::Create(&client_); | 396 content_ = FakeContentLayer::Create(&client_); |
326 content_->SetBounds(gfx::Size(10, 10)); | 397 content_->SetBounds(gfx::Size(10, 10)); |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 virtual void AfterTest() OVERRIDE {} | 1586 virtual void AfterTest() OVERRIDE {} |
1516 | 1587 |
1517 bool deferred_; | 1588 bool deferred_; |
1518 }; | 1589 }; |
1519 | 1590 |
1520 SINGLE_AND_MULTI_THREAD_TEST_F( | 1591 SINGLE_AND_MULTI_THREAD_TEST_F( |
1521 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1592 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
1522 | 1593 |
1523 } // namespace | 1594 } // namespace |
1524 } // namespace cc | 1595 } // namespace cc |
OLD | NEW |