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

Unified Diff: cc/layers/layer_list_iterator_unittest.cc

Issue 1900723002: Revert of cc: Add a main thread LayerListIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_list_iterator.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_list_iterator_unittest.cc
diff --git a/cc/layers/layer_list_iterator_unittest.cc b/cc/layers/layer_list_iterator_unittest.cc
index 503c1e6d94a9dca3464a97413961ad44fb4c33f6..d0985096cb822d24e6b552c6234c8346d2ee7dbb 100644
--- a/cc/layers/layer_list_iterator_unittest.cc
+++ b/cc/layers/layer_list_iterator_unittest.cc
@@ -8,7 +8,6 @@
#include "base/containers/adapters.h"
#include "cc/test/fake_impl_task_runner_provider.h"
-#include "cc/test/fake_layer_tree_host.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -19,183 +18,7 @@
namespace cc {
namespace {
-// Layer version unit tests
-
TEST(LayerListIteratorTest, VerifyTraversalOrder) {
- // Unfortunate preamble.
- FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
- TestTaskGraphRunner task_graph_runner;
- std::unique_ptr<FakeLayerTreeHost> host_ptr =
- FakeLayerTreeHost::Create(&client, &task_graph_runner);
- FakeLayerTreeHost* host = host_ptr.get();
-
- // This test constructs the following tree.
- // 1
- // +-2
- // | +-3
- // | +-4
- // + 5
- // +-6
- // +-7
- // We expect to visit all seven layers in that order.
- scoped_refptr<Layer> layer1 = Layer::Create();
- scoped_refptr<Layer> layer2 = Layer::Create();
- scoped_refptr<Layer> layer3 = Layer::Create();
- scoped_refptr<Layer> layer4 = Layer::Create();
- scoped_refptr<Layer> layer5 = Layer::Create();
- scoped_refptr<Layer> layer6 = Layer::Create();
- scoped_refptr<Layer> layer7 = Layer::Create();
-
- std::unordered_map<int, int> layer_id_to_order;
- layer_id_to_order[layer1->id()] = 1;
- layer_id_to_order[layer2->id()] = 2;
- layer_id_to_order[layer3->id()] = 3;
- layer_id_to_order[layer4->id()] = 4;
- layer_id_to_order[layer5->id()] = 5;
- layer_id_to_order[layer6->id()] = 6;
- layer_id_to_order[layer7->id()] = 7;
-
- layer2->AddChild(std::move(layer3));
- layer2->AddChild(std::move(layer4));
-
- layer5->AddChild(std::move(layer6));
- layer5->AddChild(std::move(layer7));
-
- layer1->AddChild(std::move(layer2));
- layer1->AddChild(std::move(layer5));
-
- host->SetRootLayer(std::move(layer1));
-
- int i = 1;
- for (auto* layer : *host) {
- EXPECT_EQ(i++, layer_id_to_order[layer->id()]);
- }
- EXPECT_EQ(8, i);
-}
-
-TEST(LayerListIteratorTest, VerifySingleLayer) {
- // Unfortunate preamble.
- FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
- TestTaskGraphRunner task_graph_runner;
- std::unique_ptr<FakeLayerTreeHost> host_ptr =
- FakeLayerTreeHost::Create(&client, &task_graph_runner);
- FakeLayerTreeHost* host = host_ptr.get();
-
- // This test constructs a tree consisting of a single layer.
- scoped_refptr<Layer> layer1 = Layer::Create();
- std::unordered_map<int, int> layer_id_to_order;
- layer_id_to_order[layer1->id()] = 1;
- host->SetRootLayer(std::move(layer1));
-
- int i = 1;
- for (auto* layer : *host) {
- EXPECT_EQ(i++, layer_id_to_order[layer->id()]);
- }
- EXPECT_EQ(2, i);
-}
-
-TEST(LayerListIteratorTest, VerifyNullFirstLayer) {
- // Ensures that if an iterator is constructed with a nullptr, that it can be
- // iterated without issue and that it remains equal to any other
- // null-initialized iterator.
- LayerListIterator<Layer> it(nullptr);
- LayerListIterator<Layer> end(nullptr);
-
- EXPECT_EQ(it, end);
- ++it;
- EXPECT_EQ(it, end);
-}
-
-TEST(LayerListReverseIteratorTest, VerifyTraversalOrder) {
- // Unfortunate preamble.
- FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
- TestTaskGraphRunner task_graph_runner;
- std::unique_ptr<FakeLayerTreeHost> host_ptr =
- FakeLayerTreeHost::Create(&client, &task_graph_runner);
- FakeLayerTreeHost* host = host_ptr.get();
-
- // This test constructs the following tree.
- // 1
- // +-2
- // | +-3
- // | +-4
- // + 5
- // +-6
- // +-7
- // We expect to visit all seven layers in reverse order.
- scoped_refptr<Layer> layer1 = Layer::Create();
- scoped_refptr<Layer> layer2 = Layer::Create();
- scoped_refptr<Layer> layer3 = Layer::Create();
- scoped_refptr<Layer> layer4 = Layer::Create();
- scoped_refptr<Layer> layer5 = Layer::Create();
- scoped_refptr<Layer> layer6 = Layer::Create();
- scoped_refptr<Layer> layer7 = Layer::Create();
-
- std::unordered_map<int, int> layer_id_to_order;
- layer_id_to_order[layer1->id()] = 1;
- layer_id_to_order[layer2->id()] = 2;
- layer_id_to_order[layer3->id()] = 3;
- layer_id_to_order[layer4->id()] = 4;
- layer_id_to_order[layer5->id()] = 5;
- layer_id_to_order[layer6->id()] = 6;
- layer_id_to_order[layer7->id()] = 7;
-
- layer2->AddChild(std::move(layer3));
- layer2->AddChild(std::move(layer4));
-
- layer5->AddChild(std::move(layer6));
- layer5->AddChild(std::move(layer7));
-
- layer1->AddChild(std::move(layer2));
- layer1->AddChild(std::move(layer5));
-
- host->SetRootLayer(std::move(layer1));
-
- int i = 7;
-
- for (auto* layer : base::Reversed(*host)) {
- EXPECT_EQ(i--, layer_id_to_order[layer->id()]);
- }
-
- EXPECT_EQ(0, i);
-}
-
-TEST(LayerListReverseIteratorTest, VerifySingleLayer) {
- // Unfortunate preamble.
- FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
- TestTaskGraphRunner task_graph_runner;
- std::unique_ptr<FakeLayerTreeHost> host_ptr =
- FakeLayerTreeHost::Create(&client, &task_graph_runner);
- FakeLayerTreeHost* host = host_ptr.get();
-
- // This test constructs a tree consisting of a single layer.
- scoped_refptr<Layer> layer1 = Layer::Create();
- std::unordered_map<int, int> layer_id_to_order;
- layer_id_to_order[layer1->id()] = 1;
- host->SetRootLayer(std::move(layer1));
-
- int i = 1;
- for (auto* layer : base::Reversed(*host)) {
- EXPECT_EQ(i--, layer_id_to_order[layer->id()]);
- }
- EXPECT_EQ(0, i);
-}
-
-TEST(LayerListReverseIteratorTest, VerifyNullFirstLayer) {
- // Ensures that if an iterator is constructed with a nullptr, that it can be
- // iterated without issue and that it remains equal to any other
- // null-initialized iterator.
- LayerListReverseIterator<Layer> it(nullptr);
- LayerListReverseIterator<Layer> end(nullptr);
-
- EXPECT_EQ(it, end);
- ++it;
- EXPECT_EQ(it, end);
-}
-
-// LayerImpl version unit tests
-
-TEST(LayerListIteratorTest, VerifyTraversalOrderImpl) {
// Unfortunate preamble.
FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
@@ -248,7 +71,7 @@
EXPECT_EQ(8, i);
}
-TEST(LayerListIteratorTest, VerifySingleLayerImpl) {
+TEST(LayerListIteratorTest, VerifySingleLayer) {
// Unfortunate preamble.
FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
@@ -271,19 +94,19 @@
EXPECT_EQ(2, i);
}
-TEST(LayerListIteratorTest, VerifyNullFirstLayerImpl) {
+TEST(LayerListIteratorTest, VerifyNullFirstLayer) {
// Ensures that if an iterator is constructed with a nullptr, that it can be
// iterated without issue and that it remains equal to any other
// null-initialized iterator.
- LayerListIterator<LayerImpl> it(nullptr);
- LayerListIterator<LayerImpl> end(nullptr);
+ LayerListIterator it(nullptr);
+ LayerListIterator end(nullptr);
EXPECT_EQ(it, end);
++it;
EXPECT_EQ(it, end);
}
-TEST(LayerListReverseIteratorTest, VerifyTraversalOrderImpl) {
+TEST(LayerListReverseIteratorTest, VerifyTraversalOrder) {
// Unfortunate preamble.
FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
@@ -338,7 +161,7 @@
EXPECT_EQ(0, i);
}
-TEST(LayerListReverseIteratorTest, VerifySingleLayerImpl) {
+TEST(LayerListReverseIteratorTest, VerifySingleLayer) {
// Unfortunate preamble.
FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
@@ -361,12 +184,12 @@
EXPECT_EQ(0, i);
}
-TEST(LayerListReverseIteratorTest, VerifyNullFirstLayerImpl) {
+TEST(LayerListReverseIteratorTest, VerifyNullFirstLayer) {
// Ensures that if an iterator is constructed with a nullptr, that it can be
// iterated without issue and that it remains equal to any other
// null-initialized iterator.
- LayerListReverseIterator<LayerImpl> it(nullptr);
- LayerListReverseIterator<LayerImpl> end(nullptr);
+ LayerListReverseIterator it(nullptr);
+ LayerListReverseIterator end(nullptr);
EXPECT_EQ(it, end);
++it;
« no previous file with comments | « cc/layers/layer_list_iterator.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698