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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "base/time/time.h" |
10 #include "components/mus/public/cpp/tests/view_manager_test_base.h" | 11 #include "components/mus/public/cpp/tests/view_manager_test_base.h" |
11 #include "components/mus/public/cpp/view.h" | 12 #include "components/mus/public/cpp/view.h" |
12 #include "components/mus/public/cpp/view_tree_connection.h" | 13 #include "components/mus/public/cpp/view_tree_connection.h" |
13 #include "components/web_view/public/interfaces/frame.mojom.h" | 14 #include "components/web_view/public/interfaces/frame.mojom.h" |
14 #include "mojo/application/public/cpp/application_impl.h" | 15 #include "mojo/application/public/cpp/application_impl.h" |
15 #include "mojo/application/public/cpp/application_test_base.h" | 16 #include "mojo/application/public/cpp/application_test_base.h" |
16 #include "net/test/spawned_test_server/spawned_test_server.h" | 17 #include "net/test/spawned_test_server/spawned_test_server.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessib
ility.mojom.h" | 19 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessib
ility.mojom.h" |
19 | 20 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 mojo::Binding<web_view::mojom::Frame> frame_binding(&frame); | 96 mojo::Binding<web_view::mojom::Frame> frame_binding(&frame); |
96 frame_binding.Bind(GetProxy(&frame_ptr).Pass()); | 97 frame_binding.Bind(GetProxy(&frame_ptr).Pass()); |
97 | 98 |
98 mojo::Array<web_view::mojom::FrameDataPtr> array(1u); | 99 mojo::Array<web_view::mojom::FrameDataPtr> array(1u); |
99 array[0] = web_view::mojom::FrameData::New().Pass(); | 100 array[0] = web_view::mojom::FrameData::New().Pass(); |
100 array[0]->frame_id = embed_view->id(); | 101 array[0]->frame_id = embed_view->id(); |
101 array[0]->parent_id = 0u; | 102 array[0]->parent_id = 0u; |
102 | 103 |
103 web_view::mojom::FrameClientPtr frame_client; | 104 web_view::mojom::FrameClientPtr frame_client; |
104 connection->ConnectToService(&frame_client); | 105 connection->ConnectToService(&frame_client); |
105 frame_client->OnConnect(frame_ptr.Pass(), 1u, embed_view->id(), | 106 frame_client->OnConnect( |
106 web_view::mojom::VIEW_CONNECT_TYPE_USE_NEW, | 107 frame_ptr.Pass(), 1u, embed_view->id(), |
107 array.Pass(), base::Closure()); | 108 web_view::mojom::VIEW_CONNECT_TYPE_USE_NEW, array.Pass(), |
| 109 base::TimeTicks::Now().ToInternalValue(), base::Closure()); |
108 | 110 |
109 // 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. |
110 AxProviderPtr ax_provider; | 112 AxProviderPtr ax_provider; |
111 connection->ConnectToService(&ax_provider); | 113 connection->ConnectToService(&ax_provider); |
112 Array<AxNodePtr> ax_tree; | 114 Array<AxNodePtr> ax_tree; |
113 ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { | 115 ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { |
114 ax_tree = tree.Pass(); | 116 ax_tree = tree.Pass(); |
115 EXPECT_TRUE(QuitRunLoop()); | 117 EXPECT_TRUE(QuitRunLoop()); |
116 }); | 118 }); |
117 ASSERT_TRUE(DoRunLoopWithTimeout()); | 119 ASSERT_TRUE(DoRunLoopWithTimeout()); |
118 | 120 |
119 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); | 121 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); |
120 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); | 122 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); |
121 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); | 123 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); |
122 } | 124 } |
123 | 125 |
124 } // namespace mojo | 126 } // namespace mojo |
OLD | NEW |