| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(frame_ptr.Pass(), 1u, embed_view->id(), |
| 106 web_view::mojom::VIEW_CONNECT_TYPE_USE_NEW, | 107 web_view::mojom::VIEW_CONNECT_TYPE_USE_NEW, |
| 107 array.Pass(), base::Closure()); | 108 array.Pass(), |
| 109 base::TimeTicks::Now().ToInternalValue(), |
| 110 base::Closure()); |
| 108 | 111 |
| 109 // Connect to the AxProvider of the HTML document and get the AxTree. | 112 // Connect to the AxProvider of the HTML document and get the AxTree. |
| 110 AxProviderPtr ax_provider; | 113 AxProviderPtr ax_provider; |
| 111 connection->ConnectToService(&ax_provider); | 114 connection->ConnectToService(&ax_provider); |
| 112 Array<AxNodePtr> ax_tree; | 115 Array<AxNodePtr> ax_tree; |
| 113 ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { | 116 ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { |
| 114 ax_tree = tree.Pass(); | 117 ax_tree = tree.Pass(); |
| 115 EXPECT_TRUE(QuitRunLoop()); | 118 EXPECT_TRUE(QuitRunLoop()); |
| 116 }); | 119 }); |
| 117 ASSERT_TRUE(DoRunLoopWithTimeout()); | 120 ASSERT_TRUE(DoRunLoopWithTimeout()); |
| 118 | 121 |
| 119 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); | 122 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); |
| 120 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); | 123 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); |
| 121 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); | 124 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); |
| 122 } | 125 } |
| 123 | 126 |
| 124 } // namespace mojo | 127 } // namespace mojo |
| OLD | NEW |