Index: services/view_manager/view_manager_service_apptest.cc |
diff --git a/services/view_manager/view_manager_service_apptest.cc b/services/view_manager/view_manager_service_apptest.cc |
index 2389291a1c7bde2ec972235b7f3e27921deb5878..7a660cdff5965b2309aab7b3b1d2eeed2d56dbd0 100644 |
--- a/services/view_manager/view_manager_service_apptest.cc |
+++ b/services/view_manager/view_manager_service_apptest.cc |
@@ -84,7 +84,20 @@ bool Embed(ViewManagerService* vm, Id root_id) { |
bool result = false; |
base::RunLoop run_loop; |
{ |
- vm->Embed("mojo:view_manager_service_apptests", root_id, nullptr, nullptr, |
+ vm->EmbedUrl("mojo:view_manager_service_apptests", root_id, nullptr, |
+ nullptr, base::Bind(&BoolResultCallback, &run_loop, &result)); |
+ } |
+ run_loop.Run(); |
+ return result; |
+} |
+ |
+bool Embed(ViewManagerService* vm, |
+ Id root_id, |
+ mojo::ViewManagerClientPtr client) { |
+ bool result = false; |
+ base::RunLoop run_loop; |
+ { |
+ vm->Embed(root_id, client.Pass(), |
base::Bind(&BoolResultCallback, &run_loop, &result)); |
} |
run_loop.Run(); |
@@ -1450,6 +1463,20 @@ TEST_F(ViewManagerServiceAppTest, CloneAndAnimate) { |
EXPECT_FALSE(HasClonedView(views)); |
} |
+// Verifies Embed() works when supplying a ViewManagerClient. |
+TEST_F(ViewManagerServiceAppTest, EmbedSupplyingViewManagerClient) { |
+ // Create 1 and 2 in the first connection and parent both to the root. |
msw
2015/02/09 19:44:12
nit: This doesn't seem to create or add |2|, just
sky
2015/02/10 00:12:59
I nuked the comment (here and above). It wasn't re
|
+ ASSERT_TRUE(CreateView(vm1(), BuildViewId(1, 1))); |
+ |
+ ViewManagerClientImpl client2; |
+ mojo::ViewManagerClientPtr client2_ptr; |
+ mojo::Binding<ViewManagerClient> client2_binding(&client2, &client2_ptr); |
+ ASSERT_TRUE(Embed(vm1(), BuildViewId(1, 1), client2_ptr.Pass())); |
+ client2.WaitForOnEmbed(); |
+ EXPECT_EQ("OnEmbed creator=mojo:window_manager", |
+ SingleChangeToDescription(*client2.tracker()->changes())); |
+} |
+ |
// TODO(sky): need to better track changes to initial connection. For example, |
// that SetBounsdViews/AddView and the like don't result in messages to the |
// originating connection. |