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

Unified Diff: services/view_manager/view_manager_service_apptest.cc

Issue 905083002: Adds Embed() variant to ViewManagerService that takes ViewManagerClient (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: EmbedUrl Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/view_manager/view_manager_app.cc ('k') | services/view_manager/view_manager_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « services/view_manager/view_manager_app.cc ('k') | services/view_manager/view_manager_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698