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

Side by Side Diff: components/html_viewer/ax_provider_apptest.cc

Issue 1681813002: Rename Connection::AddService/ConnectToService to Connection::AddInterface/GetInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_binder
Patch Set: . Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 net::EmbeddedTestServer server; 80 net::EmbeddedTestServer server;
81 server.ServeFilesFromSourceDirectory("net/data"); 81 server.ServeFilesFromSourceDirectory("net/data");
82 ASSERT_TRUE(server.Start()); 82 ASSERT_TRUE(server.Start());
83 83
84 // Connect to the URL through the mojo:html_viewer content handler. 84 // Connect to the URL through the mojo:html_viewer content handler.
85 scoped_ptr<Connection> connection = 85 scoped_ptr<Connection> connection =
86 shell()->Connect(server.GetURL("/test.html").spec()); 86 shell()->Connect(server.GetURL("/test.html").spec());
87 87
88 // Embed the html_viewer in a Window. 88 // Embed the html_viewer in a Window.
89 mus::mojom::WindowTreeClientPtr tree_client; 89 mus::mojom::WindowTreeClientPtr tree_client;
90 connection->ConnectToService(&tree_client); 90 connection->GetInterface(&tree_client);
91 mus::Window* embed_window = window_manager()->NewWindow(); 91 mus::Window* embed_window = window_manager()->NewWindow();
92 embed_window->Embed(std::move(tree_client)); 92 embed_window->Embed(std::move(tree_client));
93 93
94 TestFrame frame; 94 TestFrame frame;
95 web_view::mojom::FramePtr frame_ptr; 95 web_view::mojom::FramePtr frame_ptr;
96 mojo::Binding<web_view::mojom::Frame> frame_binding(&frame); 96 mojo::Binding<web_view::mojom::Frame> frame_binding(&frame);
97 frame_binding.Bind(GetProxy(&frame_ptr)); 97 frame_binding.Bind(GetProxy(&frame_ptr));
98 98
99 mojo::Array<web_view::mojom::FrameDataPtr> array(1u); 99 mojo::Array<web_view::mojom::FrameDataPtr> array(1u);
100 array[0] = web_view::mojom::FrameData::New(); 100 array[0] = web_view::mojom::FrameData::New();
101 array[0]->frame_id = embed_window->id(); 101 array[0]->frame_id = embed_window->id();
102 array[0]->parent_id = 0u; 102 array[0]->parent_id = 0u;
103 103
104 web_view::mojom::FrameClientPtr frame_client; 104 web_view::mojom::FrameClientPtr frame_client;
105 connection->ConnectToService(&frame_client); 105 connection->GetInterface(&frame_client);
106 frame_client->OnConnect( 106 frame_client->OnConnect(
107 std::move(frame_ptr), 1u, embed_window->id(), 107 std::move(frame_ptr), 1u, embed_window->id(),
108 web_view::mojom::WindowConnectType::USE_NEW, std::move(array), 108 web_view::mojom::WindowConnectType::USE_NEW, std::move(array),
109 base::TimeTicks::Now().ToInternalValue(), base::Closure()); 109 base::TimeTicks::Now().ToInternalValue(), base::Closure());
110 110
111 // Connect to the AxProvider of the HTML document and get the AxTree. 111 // Connect to the AxProvider of the HTML document and get the AxTree.
112 AxProviderPtr ax_provider; 112 AxProviderPtr ax_provider;
113 connection->ConnectToService(&ax_provider); 113 connection->GetInterface(&ax_provider);
114 Array<AxNodePtr> ax_tree; 114 Array<AxNodePtr> ax_tree;
115 ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { 115 ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) {
116 ax_tree = std::move(tree); 116 ax_tree = std::move(tree);
117 EXPECT_TRUE(QuitRunLoop()); 117 EXPECT_TRUE(QuitRunLoop());
118 }); 118 });
119 ASSERT_TRUE(DoRunLoopWithTimeout()); 119 ASSERT_TRUE(DoRunLoopWithTimeout());
120 120
121 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); 121 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello "));
122 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); 122 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!"));
123 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); 123 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo"));
124 } 124 }
125 125
126 } // namespace mojo 126 } // namespace mojo
OLDNEW
« no previous file with comments | « components/font_service/font_service_app.cc ('k') | components/html_viewer/blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698