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/time/time.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" | 15 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" |
15 #include "components/mus/public/cpp/tests/view_manager_test_base.h" | 16 #include "components/mus/public/cpp/tests/view_manager_test_base.h" |
16 #include "components/mus/public/cpp/view.h" | 17 #include "components/mus/public/cpp/view.h" |
17 #include "components/mus/public/cpp/view_tree_connection.h" | 18 #include "components/mus/public/cpp/view_tree_connection.h" |
18 #include "components/web_view/frame.h" | 19 #include "components/web_view/frame.h" |
19 #include "components/web_view/frame_connection.h" | 20 #include "components/web_view/frame_connection.h" |
20 #include "components/web_view/frame_tree.h" | 21 #include "components/web_view/frame_tree.h" |
21 #include "components/web_view/public/interfaces/frame.mojom.h" | 22 #include "components/web_view/public/interfaces/frame.mojom.h" |
22 #include "components/web_view/test_frame_tree_delegate.h" | 23 #include "components/web_view/test_frame_tree_delegate.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bool got_callback = false; | 220 bool got_callback = false; |
220 frame_connection->Init( | 221 frame_connection->Init( |
221 application_impl(), BuildRequestForURL(url_string), | 222 application_impl(), BuildRequestForURL(url_string), |
222 base::Bind(&OnGotContentHandlerForRoot, &got_callback)); | 223 base::Bind(&OnGotContentHandlerForRoot, &got_callback)); |
223 ignore_result(ViewManagerTestBase::DoRunLoopWithTimeout()); | 224 ignore_result(ViewManagerTestBase::DoRunLoopWithTimeout()); |
224 if (!got_callback) | 225 if (!got_callback) |
225 return nullptr; | 226 return nullptr; |
226 FrameConnection* result = frame_connection.get(); | 227 FrameConnection* result = frame_connection.get(); |
227 FrameClient* frame_client = frame_connection->frame_client(); | 228 FrameClient* frame_client = frame_connection->frame_client(); |
228 ViewTreeClientPtr tree_client = frame_connection->GetViewTreeClient(); | 229 ViewTreeClientPtr tree_client = frame_connection->GetViewTreeClient(); |
229 frame_tree_.reset( | 230 frame_tree_.reset(new FrameTree( |
230 new FrameTree(result->GetContentHandlerID(), view, tree_client.Pass(), | 231 result->GetContentHandlerID(), view, tree_client.Pass(), |
231 frame_tree_delegate_.get(), frame_client, | 232 frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), |
232 frame_connection.Pass(), Frame::ClientPropertyMap())); | 233 Frame::ClientPropertyMap(), base::TimeTicks::Now())); |
233 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); | 234 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); |
234 return result; | 235 return result; |
235 } | 236 } |
236 | 237 |
237 // ViewManagerTest: | 238 // ViewManagerTest: |
238 void SetUp() override { | 239 void SetUp() override { |
239 ViewManagerTestBase::SetUp(); | 240 ViewManagerTestBase::SetUp(); |
240 | 241 |
241 // Start a test server. | 242 // Start a test server. |
242 http_server_.reset(new net::SpawnedTestServer( | 243 http_server_.reset(new net::SpawnedTestServer( |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 script_value_as_list->GetString(0u, &message_in_child); | 472 script_value_as_list->GetString(0u, &message_in_child); |
472 } | 473 } |
473 } | 474 } |
474 } while (message_in_child != "hello from parent" && | 475 } while (message_in_child != "hello from parent" && |
475 base::TimeTicks::Now() - start_time < | 476 base::TimeTicks::Now() - start_time < |
476 TestTimeouts::action_timeout()); | 477 TestTimeouts::action_timeout()); |
477 EXPECT_EQ("hello from parent", message_in_child); | 478 EXPECT_EQ("hello from parent", message_in_child); |
478 } | 479 } |
479 | 480 |
480 } // namespace mojo | 481 } // namespace mojo |
OLD | NEW |