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

Side by Side Diff: trunk/src/mojo/services/view_manager/view_manager_connection_unittest.cc

Issue 286653003: Revert 270122 "Synchronizes View instances across clients." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/mojo/services/view_manager/view_manager_connection.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 TransportChangeId server_change_id, 232 TransportChangeId server_change_id,
233 TransportChangeId client_change_id) OVERRIDE { 233 TransportChangeId client_change_id) OVERRIDE {
234 changes_.push_back( 234 changes_.push_back(
235 base::StringPrintf( 235 base::StringPrintf(
236 "NodeDeleted change_id=%d,%d node=%s", 236 "NodeDeleted change_id=%d,%d node=%s",
237 static_cast<int>(server_change_id), 237 static_cast<int>(server_change_id),
238 static_cast<int>(client_change_id), 238 static_cast<int>(client_change_id),
239 NodeIdToString(node).c_str())); 239 NodeIdToString(node).c_str()));
240 QuitIfNecessary(); 240 QuitIfNecessary();
241 } 241 }
242 virtual void OnViewDeleted(TransportViewId view,
243 TransportChangeId server_change_id,
244 TransportChangeId client_change_id) OVERRIDE {
245 changes_.push_back(
246 base::StringPrintf(
247 "ViewDeleted change_id=%d,%d view=%s",
248 static_cast<int>(client_change_id),
249 static_cast<int>(client_change_id),
250 NodeIdToString(view).c_str()));
251 QuitIfNecessary();
252 }
253 virtual void OnNodeViewReplaced(TransportNodeId node, 242 virtual void OnNodeViewReplaced(TransportNodeId node,
254 TransportViewId new_view_id, 243 TransportViewId new_view_id,
255 TransportViewId old_view_id, 244 TransportViewId old_view_id,
256 TransportChangeId change_id) OVERRIDE { 245 TransportChangeId change_id) OVERRIDE {
257 changes_.push_back( 246 changes_.push_back(
258 base::StringPrintf( 247 base::StringPrintf(
259 "change_id=%d node=%s new_view=%s old_view=%s", 248 "change_id=%d node=%s new_view=%s old_view=%s",
260 static_cast<int>(change_id), NodeIdToString(node).c_str(), 249 static_cast<int>(change_id), NodeIdToString(node).c_str(),
261 NodeIdToString(new_view_id).c_str(), 250 NodeIdToString(new_view_id).c_str(),
262 NodeIdToString(old_view_id).c_str())); 251 NodeIdToString(old_view_id).c_str()));
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 ASSERT_EQ(1u, changes.size()); 676 ASSERT_EQ(1u, changes.size());
688 EXPECT_EQ("change_id=22 node=1,1 new_view=2,51 old_view=null", changes[0]); 677 EXPECT_EQ("change_id=22 node=1,1 new_view=2,51 old_view=null", changes[0]);
689 } 678 }
690 679
691 // Shutdown the second connection and verify view is removed. 680 // Shutdown the second connection and verify view is removed.
692 { 681 {
693 DestroySecondConnection(); 682 DestroySecondConnection();
694 client_.DoRunLoopUntilChangesCount(1); 683 client_.DoRunLoopUntilChangesCount(1);
695 684
696 Changes changes(client_.GetAndClearChanges()); 685 Changes changes(client_.GetAndClearChanges());
697 ASSERT_EQ(2u, changes.size()); 686 ASSERT_EQ(1u, changes.size());
698 EXPECT_EQ("change_id=0 node=1,1 new_view=null old_view=2,51", changes[0]); 687 EXPECT_EQ("change_id=0 node=1,1 new_view=null old_view=2,51", changes[0]);
699 } 688 }
700 } 689 }
701 690
702 // Assertions for GetNodeTree. 691 // Assertions for GetNodeTree.
703 TEST_F(ViewManagerConnectionTest, GetNodeTree) { 692 TEST_F(ViewManagerConnectionTest, GetNodeTree) {
704 EstablishSecondConnection(); 693 EstablishSecondConnection();
705 694
706 // Create two nodes in first connection, 1 and 11 (11 is a child of 1). 695 // Create two nodes in first connection, 1 and 11 (11 is a child of 1).
707 ASSERT_TRUE(CreateNode(view_manager_.get(), 1)); 696 ASSERT_TRUE(CreateNode(view_manager_.get(), 1));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); 747 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes);
759 ASSERT_EQ(2u, nodes.size()); 748 ASSERT_EQ(2u, nodes.size());
760 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); 749 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString());
761 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); 750 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString());
762 } 751 }
763 } 752 }
764 753
765 } // namespace view_manager 754 } // namespace view_manager
766 } // namespace services 755 } // namespace services
767 } // namespace mojo 756 } // namespace mojo
OLDNEW
« no previous file with comments | « trunk/src/mojo/services/view_manager/view_manager_connection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698