Chromium Code Reviews| Index: components/viz/hit_test/hit_test_aggregator_unittest.cc |
| diff --git a/components/viz/hit_test/hit_test_aggregator_unittest.cc b/components/viz/hit_test/hit_test_aggregator_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c35120eded373e8575fd7a98ea1c20ed89a71b6d |
| --- /dev/null |
| +++ b/components/viz/hit_test/hit_test_aggregator_unittest.cc |
| @@ -0,0 +1,514 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "hit_test_aggregator.h" |
| +#include "cc/surfaces/frame_sink_id.h" |
| +#include "cc/surfaces/local_surface_id.h" |
| +#include "cc/surfaces/surface_id.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace viz { |
| +namespace hit_test { |
| +namespace test { |
| + |
| +namespace { |
| + |
| +constexpr cc::FrameSinkId kDisplayFrameSink(2, 0); |
| + |
| +cc::SurfaceId MakeSurfaceId(const cc::FrameSinkId& frame_sink_id, |
| + uint32_t local_id) { |
| + return cc::SurfaceId( |
| + frame_sink_id, |
| + cc::LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); |
| +} |
| + |
| +} // namespace |
| + |
| +using namespace hit_test::mojom; |
| + |
| +class HitTestAggregatorTest : public testing::Test { |
| + public: |
| + HitTestAggregatorTest() {} |
| + ~HitTestAggregatorTest() override {} |
| + |
| + void SetUp() override {} |
| + |
| + void TearDown() override {} |
| + |
| + HitTestAggregator aggregator_; |
| + |
| + int count() { |
| + DisplayHitTestRegion* start = aggregator_.GetCurrentRegions(); |
| + DisplayHitTestRegion* end = start; |
| + while (end->child_count_ != kEndOfList) { |
| + end++; |
| + } |
| + return end - start; |
| + } |
| + |
| + DisplayHitTestRegion* RegionAtIndex(int i) { |
| + return aggregator_.GetCurrentRegions() + i; |
| + } |
| + |
| + int GetPendingCount() { return aggregator_.pending_.size(); } |
| + int GetActiveCount() { return aggregator_.active_.size(); } |
| + |
| + void Reset() { |
| + int size = aggregator_.display_hit_test_data_->size_; |
| + |
| + aggregator_.display_hit_test_data_->regions_[0].child_count_ = kEndOfList; |
| + aggregator_.display_hit_test_data_->regions_[size >> 1].child_count_ = |
| + kEndOfList; |
| + |
| + aggregator_.pending_.clear(); |
| + aggregator_.active_.clear(); |
| + } |
| +}; |
| + |
| +// tests brainstorm & todo |
|
rjkroege
2017/06/07 21:19:06
you would remove this before landing
gklassen
2017/06/08 20:33:21
ok. Agreed. Done.
|
| +// child transforms |
| +// submit late |
| +// keep surfaces until destroyed |
| +// bowtie |
| + |
| +// one surface |
|
rjkroege
2017/06/07 21:19:06
Love it! Wonderful!
And... comments need to be se
gklassen
2017/06/08 20:33:21
Agreed. Or should this be added to an .md?
rjkroege
2017/06/09 15:47:07
I like it here.
gklassen
2017/06/12 16:30:41
Acknowledged.
|
| +// |
| +// +----------+ |
| +// | | |
| +// | | |
| +// | | |
| +// +----------+ |
| +// |
| +TEST_F(HitTestAggregatorTest, OneSurface) { |
| + EXPECT_TRUE(count() == 0); |
| + |
| + cc::SurfaceId display_surface_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| + |
| + auto hit_test_data = HitTestData::New(); |
| + hit_test_data->surface_id_ = display_surface_id; |
| + hit_test_data->bounds_.SetRect(0, 0, 1024, 768); |
|
rjkroege
2017/06/07 21:19:06
So: in this case, the example receives no events y
gklassen
2017/06/08 20:33:21
I will update based on our conversation this morni
|
| + |
| + aggregator_.SubmitHitTestData(std::move(hit_test_data)); |
| + |
| + EXPECT_TRUE(count() == 0); |
| + |
| + EXPECT_TRUE(GetPendingCount() == 1); |
| + EXPECT_TRUE(GetActiveCount() == 0); |
| + |
| + aggregator_.OnSurfaceWillDraw(display_surface_id); |
| + |
| + EXPECT_TRUE(GetPendingCount() == 1); |
| + EXPECT_TRUE(GetActiveCount() == 1); |
| + |
| + aggregator_.Aggregate(display_surface_id); |
| + aggregator_.Swap(); |
| + |
| + // no sub-routing means an empty tree - all events to root |
|
rjkroege
2017/06/07 21:19:06
Ah. I am not misunderstanding. I hope.
Then you
gklassen
2017/06/08 20:33:21
I will update based on our conversation this morni
|
| + EXPECT_TRUE(count() == 0); |
| +} |
| + |
| +// one embedder two regions |
| +// |
| +// +e------------+ |
| +// | +r1-+ +r2-+ | |
| +// | | | | | | |
| +// | | | | | | |
| +// | +---+ +---+ | |
| +// +-------------+ |
| +// |
| +TEST_F(HitTestAggregatorTest, OneEmbedderTwoRegions) { |
| + Reset(); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + cc::SurfaceId e_surface_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| + |
| + auto e_hit_test_data = HitTestData::New(); |
| + e_hit_test_data->surface_id_ = e_surface_id; |
| + e_hit_test_data->bounds_.SetRect(0, 0, 1024, 768); |
| + |
| + auto r1_hit_test_region = HitTestRegion::New(); |
| + r1_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_MINE; |
| + r1_hit_test_region->rect_.SetRect(0, 0, 512, 512); |
| + |
| + auto r2_hit_test_region = HitTestRegion::New(); |
| + r2_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_MINE; |
| + r2_hit_test_region->rect_.SetRect(0, 0, 512, 512); |
|
rjkroege
2017/06/07 21:19:06
the coordinates don't match your picture?
gklassen
2017/06/08 20:33:21
Done.
|
| + |
| + e_hit_test_data->regions_.push_back(std::move(r1_hit_test_region)); |
| + e_hit_test_data->regions_.push_back(std::move(r2_hit_test_region)); |
| + |
| + // submit |
| + |
| + EXPECT_TRUE(GetPendingCount() == 0); |
| + |
| + aggregator_.SubmitHitTestData(std::move(e_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 1); |
| + |
| + // surfaces added to DisplayFrame ( in unexpected order ) |
| + |
| + EXPECT_TRUE(count() == 0); |
| + EXPECT_TRUE(GetActiveCount() == 0); |
| + |
| + aggregator_.OnSurfaceWillDraw(e_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 1); |
| + |
| + // aggregate and swap |
| + |
| + aggregator_.Aggregate(e_surface_id); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + aggregator_.Swap(); |
| + EXPECT_TRUE(count() == 3); |
| + |
| + DisplayHitTestRegion* region; |
| + |
| + region = RegionAtIndex(0); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_BOUNDS); |
| + EXPECT_TRUE(region->frame_sink_id_ == e_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 1024, 768)); |
| + EXPECT_TRUE(region->child_count_ == 2); |
| + |
| + region = RegionAtIndex(1); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_MINE); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 512, 512)); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| + |
| + region = RegionAtIndex(2); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_MINE); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 512, 512)); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| +} |
| + |
| +// one embedder two children |
| +// |
| +// +e------------+ |
| +// | +c1-+ +c2-+ | |
| +// | | | | | | |
| +// | | | | | | |
| +// | +---+ +---+ | |
| +// +-------------+ |
| +// |
| + |
| +TEST_F(HitTestAggregatorTest, OneEmbedderTwoChildren) { |
| + Reset(); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + cc::SurfaceId e_surface_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| + cc::SurfaceId c1_surface_id = MakeSurfaceId(kDisplayFrameSink, 2); |
| + cc::SurfaceId c2_surface_id = MakeSurfaceId(kDisplayFrameSink, 3); |
| + |
| + auto e_hit_test_data = HitTestData::New(); |
| + e_hit_test_data->surface_id_ = e_surface_id; |
| + e_hit_test_data->bounds_.SetRect(0, 0, 1024, 768); |
| + |
| + auto c1_hit_test_region = HitTestRegion::New(); |
|
rjkroege
2017/06/07 21:19:06
this needs a better naming convention: it's the hi
gklassen
2017/06/08 20:33:21
Done.
|
| + c1_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_CHILD_SURFACE; |
| + c1_hit_test_region->surface_id_ = c1_surface_id; |
| + c1_hit_test_region->rect_.SetRect(0, 0, 512, 512); |
| + |
| + auto c2_hit_test_region = HitTestRegion::New(); |
| + c2_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_CHILD_SURFACE; |
| + c2_hit_test_region->surface_id_ = c2_surface_id; |
| + c2_hit_test_region->rect_.SetRect(0, 0, 512, 512); |
|
rjkroege
2017/06/07 21:19:06
don't match picture. :-)
gklassen
2017/06/08 20:33:21
Done.
|
| + |
| + e_hit_test_data->regions_.push_back(std::move(c1_hit_test_region)); |
| + e_hit_test_data->regions_.push_back(std::move(c2_hit_test_region)); |
| + |
| + auto c1_hit_test_data = HitTestData::New(); |
|
rjkroege
2017/06/07 21:19:06
the children don't have bounds? i.e.: it's a bare
gklassen
2017/06/08 20:33:22
Will update based on conversation this morning.
|
| + c1_hit_test_data->surface_id_ = c1_surface_id; |
| + |
| + auto c2_hit_test_data = HitTestData::New(); |
| + c2_hit_test_data->surface_id_ = c2_surface_id; |
| + |
| + // submit ( in unexpected order ) |
| + |
| + EXPECT_TRUE(GetPendingCount() == 0); |
| + |
| + aggregator_.SubmitHitTestData(std::move(c1_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 1); |
| + |
| + aggregator_.SubmitHitTestData(std::move(e_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 2); |
| + |
| + aggregator_.SubmitHitTestData(std::move(c2_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 3); |
| + |
| + // surfaces added to DisplayFrame ( in unexpected order ) |
| + |
| + EXPECT_TRUE(count() == 0); |
| + |
| + EXPECT_TRUE(GetActiveCount() == 0); |
| + |
| + aggregator_.OnSurfaceWillDraw(c2_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 1); |
| + |
| + aggregator_.OnSurfaceWillDraw(c1_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 2); |
| + |
| + aggregator_.OnSurfaceWillDraw(e_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 3); |
| + |
| + // aggregate and swap |
| + |
| + aggregator_.Aggregate(e_surface_id); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + aggregator_.Swap(); |
| + |
| + // we expect 5 entries in the tree - one for one for each child |
|
rjkroege
2017/06/07 21:19:06
Why? The children have no bounds region? or "HIT_T
gklassen
2017/06/08 20:33:21
Will update based on conversation this morning.
|
| + EXPECT_TRUE(count() == 3); |
| + |
| + DisplayHitTestRegion* region; |
| + |
| + region = RegionAtIndex(0); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_BOUNDS); |
| + EXPECT_TRUE(region->frame_sink_id_ == e_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 1024, 768)); |
| + EXPECT_TRUE(region->child_count_ == 2); |
| + |
| + region = RegionAtIndex(1); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_CHILD_SURFACE); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 512, 512)); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| + |
| + region = RegionAtIndex(2); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_CHILD_SURFACE); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 512, 512)); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| +} |
| + |
| +// three children deep |
| +// |
| +// +e------------+ |
| +// | +c1-------+ | |
| +// | | +c2---+ | | |
| +// | | | +c3-| | | |
| +// | | | | | | | |
| +// | | | +---| | | |
| +// | | +-----+ | | |
| +// | +---------+ | |
| +// +-------------+ |
| +// |
| + |
| +TEST_F(HitTestAggregatorTest, ThreeChildrenDeep) { |
| + Reset(); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + cc::SurfaceId e_surface_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| + cc::SurfaceId c1_surface_id = MakeSurfaceId(kDisplayFrameSink, 2); |
| + cc::SurfaceId c2_surface_id = MakeSurfaceId(kDisplayFrameSink, 3); |
| + cc::SurfaceId c3_surface_id = MakeSurfaceId(kDisplayFrameSink, 4); |
| + |
| + auto e_hit_test_data = HitTestData::New(); |
| + e_hit_test_data->surface_id_ = e_surface_id; |
| + e_hit_test_data->bounds_.SetRect(0, 0, 800, 800); |
| + |
| + auto c1_hit_test_region = HitTestRegion::New(); |
| + c1_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_CHILD_SURFACE; |
| + c1_hit_test_region->surface_id_ = c1_surface_id; |
| + c1_hit_test_region->rect_.SetRect(100, 100, 700, 700); |
| + |
| + e_hit_test_data->regions_.push_back(std::move(c1_hit_test_region)); |
| + |
| + auto c1_hit_test_data = HitTestData::New(); |
| + c1_hit_test_data->surface_id_ = c1_surface_id; |
| + c1_hit_test_data->bounds_.SetRect(0, 0, 600, 600); |
| + |
| + auto c2_hit_test_region = HitTestRegion::New(); |
| + c2_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_CHILD_SURFACE; |
| + c2_hit_test_region->surface_id_ = c2_surface_id; |
| + c2_hit_test_region->rect_.SetRect(100, 100, 500, 500); |
| + |
| + c1_hit_test_data->regions_.push_back(std::move(c2_hit_test_region)); |
| + |
| + auto c2_hit_test_data = HitTestData::New(); |
| + c2_hit_test_data->surface_id_ = c2_surface_id; |
| + c2_hit_test_data->bounds_.SetRect(0, 0, 400, 400); |
| + |
| + auto c3_hit_test_region = HitTestRegion::New(); |
| + c3_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_CHILD_SURFACE; |
| + c3_hit_test_region->surface_id_ = c3_surface_id; |
| + c3_hit_test_region->rect_.SetRect(100, 100, 300, 300); |
| + |
| + c2_hit_test_data->regions_.push_back(std::move(c3_hit_test_region)); |
| + |
| + auto c3_hit_test_data = HitTestData::New(); |
| + c3_hit_test_data->surface_id_ = c3_surface_id; |
| + c3_hit_test_data->bounds_.SetRect(0, 0, 200, 200); |
| + |
| + // submit ( in unexpected order ) |
| + |
| + EXPECT_TRUE(GetPendingCount() == 0); |
| + |
| + aggregator_.SubmitHitTestData(std::move(c1_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 1); |
| + |
| + aggregator_.SubmitHitTestData(std::move(c3_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 2); |
| + |
| + aggregator_.SubmitHitTestData(std::move(e_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 3); |
| + |
| + aggregator_.SubmitHitTestData(std::move(c2_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 4); |
| + |
| + // surfaces added to DisplayFrame ( in unexpected order ) |
| + |
| + EXPECT_TRUE(count() == 0); |
| + |
| + EXPECT_TRUE(GetActiveCount() == 0); |
| + |
| + aggregator_.OnSurfaceWillDraw(c2_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 1); |
| + |
| + aggregator_.OnSurfaceWillDraw(c1_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 2); |
| + |
| + aggregator_.OnSurfaceWillDraw(e_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 3); |
| + |
| + aggregator_.OnSurfaceWillDraw(c3_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 4); |
| + |
| + // aggregate and swap |
| + |
| + aggregator_.Aggregate(e_surface_id); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + aggregator_.Swap(); |
| + |
| + // we expect 3 entries in the tree - one for each child |
| + EXPECT_TRUE(count() == 6); |
| + |
| + DisplayHitTestRegion* region; |
| + |
| + region = RegionAtIndex(0); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_BOUNDS); |
| + EXPECT_TRUE(region->frame_sink_id_ == e_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 800, 800)); |
| + EXPECT_TRUE(region->child_count_ == 5); |
| + |
| + region = RegionAtIndex(1); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_CHILD_SURFACE); |
| + EXPECT_TRUE(region->frame_sink_id_ == c1_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(100, 100, 700, 700)); |
| + EXPECT_TRUE(region->child_count_ == 4); |
| + |
| + region = RegionAtIndex(2); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_BOUNDS); |
| + EXPECT_TRUE(region->frame_sink_id_ == c1_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 600, 600)); |
| + EXPECT_TRUE(region->child_count_ == 3); |
| + |
| + region = RegionAtIndex(3); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_CHILD_SURFACE); |
| + EXPECT_TRUE(region->frame_sink_id_ == c2_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(100, 100, 500, 500)); |
| + EXPECT_TRUE(region->child_count_ == 2); |
| + |
| + region = RegionAtIndex(4); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_BOUNDS); |
| + EXPECT_TRUE(region->frame_sink_id_ == c2_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 400, 400)); |
| + EXPECT_TRUE(region->child_count_ == 1); |
| + |
| + region = RegionAtIndex(5); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_CHILD_SURFACE); |
| + EXPECT_TRUE(region->frame_sink_id_ == c3_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(100, 100, 300, 300)); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| +} |
| + |
| +// occluded child frame ( OOPIF ) |
| +// |
| +// +e-----------+ |
| +// | +c--+ | |
| +// | | +div-+ | |
| +// | | | | | |
| +// | | +----+ | |
| +// | +---+ | |
| +// +------------+ |
| +// |
| + |
| +TEST_F(HitTestAggregatorTest, OccludedChildFrame) { |
| + Reset(); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + cc::SurfaceId e_surface_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| + cc::SurfaceId c_surface_id = MakeSurfaceId(kDisplayFrameSink, 2); |
| + |
| + auto e_hit_test_data = HitTestData::New(); |
| + e_hit_test_data->surface_id_ = e_surface_id; |
| + e_hit_test_data->bounds_.SetRect(0, 0, 500, 500); |
| + |
| + auto div_hit_test_region = HitTestRegion::New(); |
| + div_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_MINE; |
| + div_hit_test_region->rect_.SetRect(100, 100, 400, 400); |
| + |
| + auto c_hit_test_region = HitTestRegion::New(); |
| + c_hit_test_region->flags_ = HitTestRegionFlags::HIT_TEST_CHILD_SURFACE; |
| + c_hit_test_region->surface_id_ = c_surface_id; |
| + c_hit_test_region->rect_.SetRect(200, 200, 500, 200); |
| + |
| + e_hit_test_data->regions_.push_back(std::move(div_hit_test_region)); |
| + e_hit_test_data->regions_.push_back(std::move(c_hit_test_region)); |
| + |
| + auto c_hit_test_data = HitTestData::New(); |
| + c_hit_test_data->surface_id_ = c_surface_id; |
| + c_hit_test_data->bounds_.SetRect(0, 0, 300, 300); |
| + |
| + // submit ( in unexpected order ) |
| + |
| + EXPECT_TRUE(GetPendingCount() == 0); |
| + |
| + aggregator_.SubmitHitTestData(std::move(c_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 1); |
| + |
| + aggregator_.SubmitHitTestData(std::move(e_hit_test_data)); |
| + EXPECT_TRUE(GetPendingCount() == 2); |
| + |
| + // surfaces added to DisplayFrame ( in unexpected order ) |
| + |
| + EXPECT_TRUE(count() == 0); |
| + |
| + EXPECT_TRUE(GetActiveCount() == 0); |
| + |
| + aggregator_.OnSurfaceWillDraw(e_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 1); |
| + |
| + aggregator_.OnSurfaceWillDraw(c_surface_id); |
| + EXPECT_TRUE(GetActiveCount() == 2); |
| + |
| + // aggregate and swap |
| + |
| + aggregator_.Aggregate(e_surface_id); |
| + EXPECT_TRUE(count() == 0); |
| + |
| + aggregator_.Swap(); |
| + |
| + EXPECT_TRUE(count() == 3); |
| + |
| + DisplayHitTestRegion* region; |
| + |
| + region = RegionAtIndex(0); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_BOUNDS); |
| + EXPECT_TRUE(region->frame_sink_id_ == e_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(0, 0, 500, 500)); |
| + EXPECT_TRUE(region->child_count_ == 2); |
| + |
| + region = RegionAtIndex(1); |
|
rjkroege
2017/06/07 21:19:06
I would expect an additional region typically yes?
gklassen
2017/06/08 20:33:22
Will update based on conversation this morning.
rjkroege
2017/06/09 15:47:07
could type "done" using the handy button to mean t
gklassen
2017/06/12 16:30:41
Done.
|
| + EXPECT_TRUE(region->rect_ == gfx::Rect(100, 100, 400, 400)); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_MINE); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| + |
| + region = RegionAtIndex(2); |
| + EXPECT_TRUE(region->rect_ == gfx::Rect(200, 200, 500, 200)); |
| + EXPECT_TRUE(region->frame_sink_id_ == c_surface_id.frame_sink_id()); |
| + EXPECT_TRUE(region->flags_ == HitTestRegionFlags::HIT_TEST_CHILD_SURFACE); |
| + EXPECT_TRUE(region->child_count_ == 0); |
| +} |
| + |
| +} // namespace test |
| +} // namespace hit_test |
| +} // namespace viz |