| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 // Set back to null. | 1613 // Set back to null. |
| 1614 ASSERT_TRUE(wt_client1()->SetWindowProperty(window_1_1, "one", NULL)); | 1614 ASSERT_TRUE(wt_client1()->SetWindowProperty(window_1_1, "one", NULL)); |
| 1615 { | 1615 { |
| 1616 wt_client2_->WaitForChangeCount(1); | 1616 wt_client2_->WaitForChangeCount(1); |
| 1617 EXPECT_EQ("PropertyChanged window=" + IdToString(window_1_1) + | 1617 EXPECT_EQ("PropertyChanged window=" + IdToString(window_1_1) + |
| 1618 " key=one value=NULL", | 1618 " key=one value=NULL", |
| 1619 SingleChangeToDescription(*changes2())); | 1619 SingleChangeToDescription(*changes2())); |
| 1620 } | 1620 } |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 TEST_F(WindowTreeClientTest, DISABLED_OnEmbeddedAppDisconnected) { | 1623 TEST_F(WindowTreeClientTest, OnEmbeddedAppDisconnected) { |
| 1624 // Create connection 2 and 3. | 1624 // Create connection 2 and 3. |
| 1625 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1625 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
| 1626 Id window_1_1 = BuildWindowId(connection_id_1(), 1); | 1626 Id window_1_1 = BuildWindowId(connection_id_1(), 1); |
| 1627 Id window_2_1 = wt_client2()->NewWindow(1); | 1627 Id window_2_1 = wt_client2()->NewWindow(1); |
| 1628 ASSERT_TRUE(window_2_1); | 1628 ASSERT_TRUE(window_2_1); |
| 1629 ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1)); | 1629 ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1)); |
| 1630 changes2()->clear(); | 1630 changes2()->clear(); |
| 1631 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_1)); | 1631 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(wt2(), window_2_1)); |
| 1632 | 1632 |
| 1633 // Connection 1 should get a hierarchy change for window_2_1. | 1633 // Connection 1 should get a hierarchy change for window_2_1. |
| 1634 wt_client1_->WaitForChangeCount(1); | 1634 wt_client1_->WaitForChangeCount(1); |
| 1635 changes1()->clear(); | 1635 changes1()->clear(); |
| 1636 | 1636 |
| 1637 // Close connection 3. Connection 2 (which had previously embedded 3) should | 1637 // Close connection 3. Connection 2 (which had previously embedded 3) should |
| 1638 // be notified of this. | 1638 // be notified of this. |
| 1639 wt_client3_.reset(); | 1639 wt_client3_.reset(); |
| 1640 wt_client2_->WaitForChangeCount(1); | 1640 wt_client2_->WaitForChangeCount(1); |
| 1641 EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_2_1), | 1641 EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_2_1), |
| 1642 SingleChangeToDescription(*changes2())); | 1642 SingleChangeToDescription(*changes2())); |
| 1643 | 1643 |
| 1644 wt_client1_->WaitForChangeCount(1); | 1644 // The closing is only interesting to the root that did the embedding. Other |
| 1645 EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_2_1), | 1645 // connections should not be notified of this. |
| 1646 SingleChangeToDescription(*changes1())); | 1646 wt_client1_->WaitForAllMessages(); |
| 1647 EXPECT_TRUE(changes1()->empty()); |
| 1647 } | 1648 } |
| 1648 | 1649 |
| 1649 // Verifies when the parent of an Embed() is destroyed the embedded app gets | 1650 // Verifies when the parent of an Embed() is destroyed the embedded app gets |
| 1650 // a WindowDeleted (and doesn't trigger a DCHECK). | 1651 // a WindowDeleted (and doesn't trigger a DCHECK). |
| 1651 TEST_F(WindowTreeClientTest, OnParentOfEmbedDisconnects) { | 1652 TEST_F(WindowTreeClientTest, OnParentOfEmbedDisconnects) { |
| 1652 // Create connection 2 and 3. | 1653 // Create connection 2 and 3. |
| 1653 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); | 1654 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
| 1654 Id window_1_1 = BuildWindowId(connection_id_1(), 1); | 1655 Id window_1_1 = BuildWindowId(connection_id_1(), 1); |
| 1655 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1)); | 1656 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1)); |
| 1656 Id window_2_1 = wt_client2()->NewWindow(1); | 1657 Id window_2_1 = wt_client2()->NewWindow(1); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 | 1916 |
| 1916 // TODO(sky): make sure coverage of what was | 1917 // TODO(sky): make sure coverage of what was |
| 1917 // WindowManagerTest.SecondEmbedRoot_InitService and | 1918 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 1918 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 1919 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 1919 // manager | 1920 // manager |
| 1920 // tests. | 1921 // tests. |
| 1921 | 1922 |
| 1922 } // namespace test | 1923 } // namespace test |
| 1923 } // namespace ws | 1924 } // namespace ws |
| 1924 } // namespace mus | 1925 } // namespace mus |
| OLD | NEW |