diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 21:11:54 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 21:11:54 +0000 |
commit | 7aeb8a933bb8c7d8e5fe34a8ab5740ce6b86e238 (patch) | |
tree | e9ff16acc9634496e954e94bee4b73fb6850ac0e /mojo | |
parent | c70eae7d0badbff5763c481c097da03a8aca81ea (diff) | |
download | chromium_src-7aeb8a933bb8c7d8e5fe34a8ab5740ce6b86e238.zip chromium_src-7aeb8a933bb8c7d8e5fe34a8ab5740ce6b86e238.tar.gz chromium_src-7aeb8a933bb8c7d8e5fe34a8ab5740ce6b86e238.tar.bz2 |
Makes the view manager notify the client of new roots correctly
Prior to this patch the server would not notify the client of a new
root if the client already knew about the root. Now it always
notifies.
Here's an example of this case: two nodes, A and B with B a child of
A and A the root for the client. If B is added as a root then
previously I would not send B in OnRootsAdded. Now I do.
BUG=365012
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/323413003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r-- | mojo/services/view_manager/view_manager_connection.cc | 8 | ||||
-rw-r--r-- | mojo/services/view_manager/view_manager_connection_unittest.cc | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/mojo/services/view_manager/view_manager_connection.cc b/mojo/services/view_manager/view_manager_connection.cc index 0c724bd..c3053c0d 100644 --- a/mojo/services/view_manager/view_manager_connection.cc +++ b/mojo/services/view_manager/view_manager_connection.cc @@ -436,10 +436,14 @@ bool ViewManagerConnection::AddRoots( did_add_root = true; roots_.insert(node_ids[i]); + Node* node = GetNode(NodeIdFromTransportId(node_ids[i])); + DCHECK(node); if (known_nodes_.count(node_ids[i]) == 0) { - Node* node = GetNode(NodeIdFromTransportId(node_ids[i])); - DCHECK(node); GetUnknownNodesFrom(node, &to_send); + } else { + // Even though the connection knows about the new root we need to tell it + // |node| is now a root. + to_send.push_back(node); } } diff --git a/mojo/services/view_manager/view_manager_connection_unittest.cc b/mojo/services/view_manager/view_manager_connection_unittest.cc index d9280d8..8cfc77a 100644 --- a/mojo/services/view_manager/view_manager_connection_unittest.cc +++ b/mojo/services/view_manager/view_manager_connection_unittest.cc @@ -1299,6 +1299,9 @@ TEST_F(ViewManagerConnectionTest, CantGetNodeTreeOfOtherRoots) { TEST_F(ViewManagerConnectionTest, ConnectTwice) { ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 1))); ASSERT_TRUE(connection_->CreateNode(BuildNodeId(1, 2))); + + ASSERT_TRUE(connection_->AddNode(BuildNodeId(1, 1), BuildNodeId(1, 2), 1)); + ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); // Try to connect again to 1,1, this should fail as already connected to that @@ -1318,7 +1321,7 @@ TEST_F(ViewManagerConnectionTest, ConnectTwice) { const Changes changes(ChangesToDescription1(connection2_->changes())); ASSERT_EQ(1u, changes.size()); EXPECT_EQ("OnRootsAdded", changes[0]); - EXPECT_EQ("[node=1,2 parent=null view=null]", + EXPECT_EQ("[node=1,2 parent=1,1 view=null]", ChangeNodeDescription(connection2_->changes())); } } |