| 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/time/time.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" | 15 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" |
| 16 #include "components/mus/public/cpp/tests/window_server_test_base.h" | 16 #include "components/mus/public/cpp/tests/window_server_test_base.h" |
| 17 #include "components/mus/public/cpp/window.h" | 17 #include "components/mus/public/cpp/window.h" |
| 18 #include "components/mus/public/cpp/window_tree_connection.h" | 18 #include "components/mus/public/cpp/window_tree_connection.h" |
| 19 #include "components/web_view/frame.h" | 19 #include "components/web_view/frame.h" |
| 20 #include "components/web_view/frame_connection.h" | 20 #include "components/web_view/frame_connection.h" |
| 21 #include "components/web_view/frame_tree.h" | 21 #include "components/web_view/frame_tree.h" |
| 22 #include "components/web_view/public/interfaces/frame.mojom.h" | 22 #include "components/web_view/public/interfaces/frame.mojom.h" |
| 23 #include "components/web_view/test_frame_tree_delegate.h" | 23 #include "components/web_view/test_frame_tree_delegate.h" |
| 24 #include "mojo/application/public/cpp/application_impl.h" | 24 #include "mojo/application/public/cpp/application_impl.h" |
| 25 #include "net/test/spawned_test_server/spawned_test_server.h" | 25 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 26 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessib
ility.mojom.h" | 26 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessib
ility.mojom.h" |
| 27 | 27 |
| 28 using mus::mojom::WindowTreeClientPtr; |
| 28 using mus::WindowServerTestBase; | 29 using mus::WindowServerTestBase; |
| 29 using web_view::Frame; | 30 using web_view::Frame; |
| 30 using web_view::FrameConnection; | 31 using web_view::FrameConnection; |
| 31 using web_view::FrameTree; | 32 using web_view::FrameTree; |
| 32 using web_view::FrameTreeDelegate; | 33 using web_view::FrameTreeDelegate; |
| 33 using web_view::mojom::FrameClient; | 34 using web_view::mojom::FrameClient; |
| 34 | 35 |
| 35 namespace mojo { | 36 namespace mojo { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); | 220 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); |
| 220 bool got_callback = false; | 221 bool got_callback = false; |
| 221 frame_connection->Init( | 222 frame_connection->Init( |
| 222 application_impl(), BuildRequestForURL(url_string), | 223 application_impl(), BuildRequestForURL(url_string), |
| 223 base::Bind(&OnGotContentHandlerForRoot, &got_callback)); | 224 base::Bind(&OnGotContentHandlerForRoot, &got_callback)); |
| 224 ignore_result(WindowServerTestBase::DoRunLoopWithTimeout()); | 225 ignore_result(WindowServerTestBase::DoRunLoopWithTimeout()); |
| 225 if (!got_callback) | 226 if (!got_callback) |
| 226 return nullptr; | 227 return nullptr; |
| 227 FrameConnection* result = frame_connection.get(); | 228 FrameConnection* result = frame_connection.get(); |
| 228 FrameClient* frame_client = frame_connection->frame_client(); | 229 FrameClient* frame_client = frame_connection->frame_client(); |
| 229 ViewTreeClientPtr tree_client = frame_connection->GetViewTreeClient(); | 230 WindowTreeClientPtr tree_client = frame_connection->GetWindowTreeClient(); |
| 230 frame_tree_.reset(new FrameTree( | 231 frame_tree_.reset(new FrameTree( |
| 231 result->GetContentHandlerID(), view, tree_client.Pass(), | 232 result->GetContentHandlerID(), view, tree_client.Pass(), |
| 232 frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), | 233 frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), |
| 233 Frame::ClientPropertyMap(), base::TimeTicks::Now())); | 234 Frame::ClientPropertyMap(), base::TimeTicks::Now())); |
| 234 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); | 235 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); |
| 235 return result; | 236 return result; |
| 236 } | 237 } |
| 237 | 238 |
| 238 // ViewManagerTest: | 239 // ViewManagerTest: |
| 239 void SetUp() override { | 240 void SetUp() override { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 script_value_as_list->GetString(0u, &message_in_child); | 473 script_value_as_list->GetString(0u, &message_in_child); |
| 473 } | 474 } |
| 474 } | 475 } |
| 475 } while (message_in_child != "hello from parent" && | 476 } while (message_in_child != "hello from parent" && |
| 476 base::TimeTicks::Now() - start_time < | 477 base::TimeTicks::Now() - start_time < |
| 477 TestTimeouts::action_timeout()); | 478 TestTimeouts::action_timeout()); |
| 478 EXPECT_EQ("hello from parent", message_in_child); | 479 EXPECT_EQ("hello from parent", message_in_child); |
| 479 } | 480 } |
| 480 | 481 |
| 481 } // namespace mojo | 482 } // namespace mojo |
| OLD | NEW |