OLD | NEW |
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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" | 14 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" |
15 #include "components/mus/public/cpp/tests/view_manager_test_base.h" | 15 #include "components/mus/public/cpp/tests/view_manager_test_base.h" |
16 #include "components/mus/public/cpp/view.h" | 16 #include "components/mus/public/cpp/view.h" |
17 #include "components/mus/public/cpp/view_tree_connection.h" | 17 #include "components/mus/public/cpp/view_tree_connection.h" |
18 #include "components/web_view/frame.h" | 18 #include "components/web_view/frame.h" |
19 #include "components/web_view/frame_connection.h" | 19 #include "components/web_view/frame_connection.h" |
20 #include "components/web_view/frame_tree.h" | 20 #include "components/web_view/frame_tree.h" |
21 #include "components/web_view/public/interfaces/frame_tree.mojom.h" | 21 #include "components/web_view/public/interfaces/frame.mojom.h" |
22 #include "components/web_view/test_frame_tree_delegate.h" | 22 #include "components/web_view/test_frame_tree_delegate.h" |
23 #include "mojo/application/public/cpp/application_impl.h" | 23 #include "mojo/application/public/cpp/application_impl.h" |
24 #include "net/test/spawned_test_server/spawned_test_server.h" | 24 #include "net/test/spawned_test_server/spawned_test_server.h" |
25 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessib
ility.mojom.h" | 25 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessib
ility.mojom.h" |
26 | 26 |
27 using mus::ViewManagerTestBase; | 27 using mus::ViewManagerTestBase; |
28 using web_view::Frame; | 28 using web_view::Frame; |
29 using web_view::FrameConnection; | 29 using web_view::FrameConnection; |
30 using web_view::FrameTree; | 30 using web_view::FrameTree; |
31 using web_view::FrameTreeClient; | |
32 using web_view::FrameTreeDelegate; | 31 using web_view::FrameTreeDelegate; |
| 32 using web_view::mojom::FrameClient; |
33 | 33 |
34 namespace mojo { | 34 namespace mojo { |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 const char kAddFrameWithEmptyPageScript[] = | 38 const char kAddFrameWithEmptyPageScript[] = |
39 "var iframe = document.createElement(\"iframe\");" | 39 "var iframe = document.createElement(\"iframe\");" |
40 "iframe.src = \"http://127.0.0.1:%u/files/empty_page.html\";" | 40 "iframe.src = \"http://127.0.0.1:%u/files/empty_page.html\";" |
41 "document.body.appendChild(iframe);"; | 41 "document.body.appendChild(iframe);"; |
42 | 42 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 new TestFrameTreeDelegateImpl(application_impl())); | 217 new TestFrameTreeDelegateImpl(application_impl())); |
218 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); | 218 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); |
219 bool got_callback = false; | 219 bool got_callback = false; |
220 frame_connection->Init( | 220 frame_connection->Init( |
221 application_impl(), BuildRequestForURL(url_string), | 221 application_impl(), BuildRequestForURL(url_string), |
222 base::Bind(&OnGotContentHandlerForRoot, &got_callback)); | 222 base::Bind(&OnGotContentHandlerForRoot, &got_callback)); |
223 ignore_result(ViewManagerTestBase::DoRunLoopWithTimeout()); | 223 ignore_result(ViewManagerTestBase::DoRunLoopWithTimeout()); |
224 if (!got_callback) | 224 if (!got_callback) |
225 return nullptr; | 225 return nullptr; |
226 FrameConnection* result = frame_connection.get(); | 226 FrameConnection* result = frame_connection.get(); |
227 FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); | 227 FrameClient* frame_client = frame_connection->frame_client(); |
228 ViewTreeClientPtr tree_client = frame_connection->GetViewTreeClient(); | 228 ViewTreeClientPtr tree_client = frame_connection->GetViewTreeClient(); |
229 frame_tree_.reset( | 229 frame_tree_.reset( |
230 new FrameTree(result->GetContentHandlerID(), view, tree_client.Pass(), | 230 new FrameTree(result->GetContentHandlerID(), view, tree_client.Pass(), |
231 frame_tree_delegate_.get(), frame_tree_client, | 231 frame_tree_delegate_.get(), frame_client, |
232 frame_connection.Pass(), Frame::ClientPropertyMap())); | 232 frame_connection.Pass(), Frame::ClientPropertyMap())); |
233 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); | 233 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); |
234 return result; | 234 return result; |
235 } | 235 } |
236 | 236 |
237 // ViewManagerTest: | 237 // ViewManagerTest: |
238 void SetUp() override { | 238 void SetUp() override { |
239 ViewManagerTestBase::SetUp(); | 239 ViewManagerTestBase::SetUp(); |
240 | 240 |
241 // Start a test server. | 241 // Start a test server. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 script_value_as_list->GetString(0u, &message_in_child); | 471 script_value_as_list->GetString(0u, &message_in_child); |
472 } | 472 } |
473 } | 473 } |
474 } while (message_in_child != "hello from parent" && | 474 } while (message_in_child != "hello from parent" && |
475 base::TimeTicks::Now() - start_time < | 475 base::TimeTicks::Now() - start_time < |
476 TestTimeouts::action_timeout()); | 476 TestTimeouts::action_timeout()); |
477 EXPECT_EQ("hello from parent", message_in_child); | 477 EXPECT_EQ("hello from parent", message_in_child); |
478 } | 478 } |
479 | 479 |
480 } // namespace mojo | 480 } // namespace mojo |
OLD | NEW |