| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "cc/output/compositor_frame.h" | 6 #include "cc/output/compositor_frame.h" |
| 7 #include "cc/output/delegated_frame_data.h" | 7 #include "cc/output/delegated_frame_data.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_factory.h" | 9 #include "cc/surfaces/surface_factory.h" |
| 10 #include "cc/surfaces/surface_factory_client.h" | 10 #include "cc/surfaces/surface_factory_client.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 { | 353 { |
| 354 SCOPED_TRACE("fourth frame, second unref"); | 354 SCOPED_TRACE("fourth frame, second unref"); |
| 355 ResourceProvider::ResourceId expected_returned_ids[] = {12, 13}; | 355 ResourceProvider::ResourceId expected_returned_ids[] = {12, 13}; |
| 356 int expected_returned_counts[] = {2, 2}; | 356 int expected_returned_counts[] = {2, 2}; |
| 357 CheckReturnedResourcesMatchExpected(expected_returned_ids, | 357 CheckReturnedResourcesMatchExpected(expected_returned_ids, |
| 358 expected_returned_counts, | 358 expected_returned_counts, |
| 359 arraysize(expected_returned_counts)); | 359 arraysize(expected_returned_counts)); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 TEST_F(SurfaceFactoryTest, BlankNoIndexIncrement) { |
| 364 SurfaceId surface_id(6); |
| 365 factory_.Create(surface_id); |
| 366 Surface* surface = manager_.GetSurfaceForId(surface_id); |
| 367 ASSERT_NE(nullptr, surface); |
| 368 EXPECT_EQ(2, surface->frame_index()); |
| 369 scoped_ptr<CompositorFrame> frame(new CompositorFrame); |
| 370 frame->delegated_frame_data.reset(new DelegatedFrameData); |
| 371 |
| 372 factory_.SubmitFrame(surface_id, frame.Pass(), |
| 373 SurfaceFactory::DrawCallback()); |
| 374 EXPECT_EQ(2, surface->frame_index()); |
| 375 factory_.Destroy(surface_id); |
| 376 } |
| 377 |
| 363 void DrawCallback(uint32* execute_count, | 378 void DrawCallback(uint32* execute_count, |
| 364 SurfaceDrawStatus* result, | 379 SurfaceDrawStatus* result, |
| 365 SurfaceDrawStatus drawn) { | 380 SurfaceDrawStatus drawn) { |
| 366 *execute_count += 1; | 381 *execute_count += 1; |
| 367 *result = drawn; | 382 *result = drawn; |
| 368 } | 383 } |
| 369 | 384 |
| 370 // Tests doing a DestroyAll before shutting down the factory; | 385 // Tests doing a DestroyAll before shutting down the factory; |
| 371 TEST_F(SurfaceFactoryTest, DestroyAll) { | 386 TEST_F(SurfaceFactoryTest, DestroyAll) { |
| 372 SurfaceId id(7); | 387 SurfaceId id(7); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 factory_.Create(id2); | 429 factory_.Create(id2); |
| 415 DCHECK(manager_.GetSurfaceForId(id2)); | 430 DCHECK(manager_.GetSurfaceForId(id2)); |
| 416 manager_.GetSurfaceForId(id2) | 431 manager_.GetSurfaceForId(id2) |
| 417 ->AddDestructionDependency(SurfaceSequence(0, 6)); | 432 ->AddDestructionDependency(SurfaceSequence(0, 6)); |
| 418 factory_.Destroy(id2); | 433 factory_.Destroy(id2); |
| 419 DCHECK(!manager_.GetSurfaceForId(id2)); | 434 DCHECK(!manager_.GetSurfaceForId(id2)); |
| 420 } | 435 } |
| 421 | 436 |
| 422 } // namespace | 437 } // namespace |
| 423 } // namespace cc | 438 } // namespace cc |
| OLD | NEW |