| Index: ui/display/display_list_unittest.cc
|
| diff --git a/ui/display/display_list_unittest.cc b/ui/display/display_list_unittest.cc
|
| index 9873450bc0ad6fd06728f18047422ec3235e613d..49543db1210afd30e63a7bec3416fef3117acdd2 100644
|
| --- a/ui/display/display_list_unittest.cc
|
| +++ b/ui/display/display_list_unittest.cc
|
| @@ -109,5 +109,31 @@ TEST(DisplayListTest, AddUpdateRemove) {
|
| EXPECT_EQ(3, display_list.GetPrimaryDisplayIterator()->id());
|
| }
|
|
|
| +TEST(DisplayListTest, SuspendUpdates) {
|
| + DisplayList display_list;
|
| + display_list.AddDisplay(display::Display(2, gfx::Rect(0, 0, 801, 802)),
|
| + DisplayList::Type::PRIMARY);
|
| + DisplayObserverImpl observer;
|
| + display_list.AddObserver(&observer);
|
| + {
|
| + // Suspend updates and add a new display.
|
| + std::unique_ptr<DisplayListObserverLock> lock =
|
| + display_list.SuspendObserverUpdates();
|
| + display_list.AddDisplay(display::Display(3, gfx::Rect(0, 0, 809, 802)),
|
| + DisplayList::Type::NOT_PRIMARY);
|
| + EXPECT_EQ(2u, display_list.displays().size());
|
| + // No update should have been generated.
|
| + EXPECT_TRUE(observer.GetAndClearChanges().empty());
|
| + }
|
| + // The lock has been destroyed, but no updates should be sent yet.
|
| + EXPECT_TRUE(observer.GetAndClearChanges().empty());
|
| +
|
| + // Update a display and verify observer called.
|
| + display::Display updated_display = display_list.displays()[0];
|
| + updated_display.set_bounds(gfx::Rect(0, 0, 803, 802));
|
| + display_list.UpdateDisplay(updated_display, DisplayList::Type::PRIMARY);
|
| + EXPECT_EQ("Changed id=2 bounds", observer.GetAndClearChanges());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace display
|
|
|