Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 822713002: Update from https://crrev.com/309415 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "cc/output/compositor_frame.h" 5 #include "cc/output/compositor_frame.h"
6 #include "cc/output/delegated_frame_data.h" 6 #include "cc/output/delegated_frame_data.h"
7 #include "cc/quads/render_pass.h" 7 #include "cc/quads/render_pass.h"
8 #include "cc/quads/render_pass_draw_quad.h" 8 #include "cc/quads/render_pass_draw_quad.h"
9 #include "cc/quads/solid_color_draw_quad.h" 9 #include "cc/quads/solid_color_draw_quad.h"
10 #include "cc/quads/surface_draw_quad.h" 10 #include "cc/quads/surface_draw_quad.h"
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 ASSERT_EQ(3u, client.returned_resources().size()); 1335 ASSERT_EQ(3u, client.returned_resources().size());
1336 ResourceProvider::ResourceId returned_ids[3]; 1336 ResourceProvider::ResourceId returned_ids[3];
1337 for (size_t i = 0; i < 3; ++i) { 1337 for (size_t i = 0; i < 3; ++i) {
1338 returned_ids[i] = client.returned_resources()[i].id; 1338 returned_ids[i] = client.returned_resources()[i].id;
1339 } 1339 }
1340 EXPECT_THAT(returned_ids, 1340 EXPECT_THAT(returned_ids,
1341 testing::WhenSorted(testing::ElementsAreArray(ids))); 1341 testing::WhenSorted(testing::ElementsAreArray(ids)));
1342 factory.Destroy(surface_id); 1342 factory.Destroy(surface_id);
1343 } 1343 }
1344 1344
1345 TEST_F(SurfaceAggregatorWithResourcesTest, TakeInvalidResources) {
1346 ResourceTrackingSurfaceFactoryClient client;
1347 SurfaceFactory factory(&manager_, &client);
1348 SurfaceId surface_id(7u);
1349 factory.Create(surface_id);
1350
1351 scoped_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData);
1352 scoped_ptr<RenderPass> pass = RenderPass::Create();
1353 pass->id = RenderPassId(1, 1);
1354 TransferableResource resource;
1355 resource.id = 11;
1356 // ResourceProvider is software but resource is not, so it should be
1357 // ignored.
1358 resource.is_software = false;
1359 frame_data->resource_list.push_back(resource);
1360 frame_data->render_pass_list.push_back(pass.Pass());
1361 scoped_ptr<CompositorFrame> frame(new CompositorFrame);
1362 frame->delegated_frame_data = frame_data.Pass();
1363 factory.SubmitFrame(surface_id, frame.Pass(), SurfaceFactory::DrawCallback());
1364
1365 scoped_ptr<CompositorFrame> returned_frame =
1366 aggregator_->Aggregate(surface_id);
1367
1368 // Nothing should be available to be returned yet.
1369 EXPECT_TRUE(client.returned_resources().empty());
1370
1371 SubmitFrameWithResources(NULL, 0u, &factory, surface_id);
1372 ASSERT_EQ(1u, client.returned_resources().size());
1373 EXPECT_EQ(11u, client.returned_resources()[0].id);
1374
1375 factory.Destroy(surface_id);
1376 }
1377
1345 TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) { 1378 TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) {
1346 ResourceTrackingSurfaceFactoryClient client; 1379 ResourceTrackingSurfaceFactoryClient client;
1347 SurfaceFactory factory(&manager_, &client); 1380 SurfaceFactory factory(&manager_, &client);
1348 SurfaceId surface_id(7u); 1381 SurfaceId surface_id(7u);
1349 factory.Create(surface_id); 1382 factory.Create(surface_id);
1350 SurfaceId surface_id2(8u); 1383 SurfaceId surface_id2(8u);
1351 factory.Create(surface_id2); 1384 factory.Create(surface_id2);
1352 1385
1353 ResourceProvider::ResourceId ids[] = {11, 12, 13}; 1386 ResourceProvider::ResourceId ids[] = {11, 12, 13};
1354 SubmitFrameWithResources(ids, arraysize(ids), &factory, surface_id); 1387 SubmitFrameWithResources(ids, arraysize(ids), &factory, surface_id);
(...skipping 18 matching lines...) Expand all
1373 EXPECT_THAT(returned_ids, 1406 EXPECT_THAT(returned_ids,
1374 testing::WhenSorted(testing::ElementsAreArray(ids))); 1407 testing::WhenSorted(testing::ElementsAreArray(ids)));
1375 EXPECT_EQ(3u, resource_provider_->num_resources()); 1408 EXPECT_EQ(3u, resource_provider_->num_resources());
1376 factory.Destroy(surface_id); 1409 factory.Destroy(surface_id);
1377 factory.Destroy(surface_id2); 1410 factory.Destroy(surface_id2);
1378 } 1411 }
1379 1412
1380 } // namespace 1413 } // namespace
1381 } // namespace cc 1414 } // namespace cc
1382 1415
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698