| 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 <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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 QuitIfNecessary(); | 225 QuitIfNecessary(); |
| 226 } | 226 } |
| 227 virtual void OnNodeDeleted(TransportNodeId node, | 227 virtual void OnNodeDeleted(TransportNodeId node, |
| 228 TransportChangeId change_id) OVERRIDE { | 228 TransportChangeId change_id) OVERRIDE { |
| 229 changes_.push_back( | 229 changes_.push_back( |
| 230 base::StringPrintf( | 230 base::StringPrintf( |
| 231 "change_id=%d node=%s deleted", | 231 "change_id=%d node=%s deleted", |
| 232 static_cast<int>(change_id), NodeIdToString(node).c_str())); | 232 static_cast<int>(change_id), NodeIdToString(node).c_str())); |
| 233 QuitIfNecessary(); | 233 QuitIfNecessary(); |
| 234 } | 234 } |
| 235 virtual void OnViewDeleted(TransportViewId view, |
| 236 TransportChangeId change_id) OVERRIDE { |
| 237 changes_.push_back( |
| 238 base::StringPrintf( |
| 239 "change_id=%d view=%s deleted", |
| 240 static_cast<int>(change_id), NodeIdToString(view).c_str())); |
| 241 QuitIfNecessary(); |
| 242 } |
| 235 | 243 |
| 236 void QuitIfNecessary() { | 244 void QuitIfNecessary() { |
| 237 if (quit_count_ > 0 && --quit_count_ == 0) | 245 if (quit_count_ > 0 && --quit_count_ == 0) |
| 238 current_run_loop->Quit(); | 246 current_run_loop->Quit(); |
| 239 } | 247 } |
| 240 | 248 |
| 241 TransportConnectionId id_; | 249 TransportConnectionId id_; |
| 242 | 250 |
| 243 // Used to determine when/if to quit the run loop. | 251 // Used to determine when/if to quit the run loop. |
| 244 size_t quit_count_; | 252 size_t quit_count_; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); | 633 GetNodeTree(view_manager2_.get(), CreateNodeId(1, 1), &nodes); |
| 626 ASSERT_EQ(2u, nodes.size()); | 634 ASSERT_EQ(2u, nodes.size()); |
| 627 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); | 635 EXPECT_EQ("node=1,1 parent=0,1 view=null", nodes[0].ToString()); |
| 628 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); | 636 EXPECT_EQ("node=1,11 parent=1,1 view=1,51", nodes[1].ToString()); |
| 629 } | 637 } |
| 630 } | 638 } |
| 631 | 639 |
| 632 } // namespace view_manager | 640 } // namespace view_manager |
| 633 } // namespace services | 641 } // namespace services |
| 634 } // namespace mojo | 642 } // namespace mojo |
| OLD | NEW |