| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/services/html_viewer/ax_provider_impl.h" | 5 #include "mojo/services/html_viewer/ax_provider_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "gin/public/isolate_holder.h" | 9 #include "gin/public/isolate_holder.h" |
| 10 #include "mojo/services/html_viewer/blink_platform_impl.h" | 10 #include "mojo/services/html_viewer/blink_platform_impl.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 TEST_F(AxProviderImplTest, Basic) { | 91 TEST_F(AxProviderImplTest, Basic) { |
| 92 TestWebViewClient web_view_client; | 92 TestWebViewClient web_view_client; |
| 93 TestWebFrameClient web_frame_client; | 93 TestWebFrameClient web_frame_client; |
| 94 WebView* view = WebView::create(&web_view_client); | 94 WebView* view = WebView::create(&web_view_client); |
| 95 view->setMainFrame(WebLocalFrame::create(&web_frame_client)); | 95 view->setMainFrame(WebLocalFrame::create(&web_frame_client)); |
| 96 view->mainFrame()->loadHTMLString( | 96 view->mainFrame()->loadHTMLString( |
| 97 WebData( | 97 WebData( |
| 98 "<html><body>foo<a " | 98 "<html><body>foo<a " |
| 99 "href='http://monkey.net'>bar</a>baz</body></html>"), | 99 "href='http://monkey.net'>bar</a>baz</body></html>"), |
| 100 WebURL(GURL("http://someplace.net"))); | 100 WebURL(GURL("http://someplace.net"))); |
| 101 base::MessageLoop::current()->Run(); | 101 //base::MessageLoop::current()->Run(); |
| 102 | 102 |
| 103 html_viewer::AxProviderImpl ax_provider_impl(view); | 103 html_viewer::AxProviderImpl ax_provider_impl(view); |
| 104 NodeCatcher catcher; | 104 NodeCatcher catcher; |
| 105 ax_provider_impl.GetTree( | 105 ax_provider_impl.GetTree( |
| 106 base::Bind(&NodeCatcher::OnNodes, base::Unretained(&catcher))); | 106 base::Bind(&NodeCatcher::OnNodes, base::Unretained(&catcher))); |
| 107 | 107 |
| 108 std::map<uint32, AxNode*> lookup; | 108 std::map<uint32, AxNode*> lookup; |
| 109 for (size_t i = 0; i < catcher.nodes.size(); ++i) { | 109 for (size_t i = 0; i < catcher.nodes.size(); ++i) { |
| 110 auto& node = catcher.nodes[i]; | 110 auto& node = catcher.nodes[i]; |
| 111 lookup[node->id] = node.get(); | 111 lookup[node->id] = node.get(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 "", | 169 "", |
| 170 "")); | 170 "")); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 // TODO(aa): Test bounds. | 174 // TODO(aa): Test bounds. |
| 175 // TODO(aa): Test sibling ordering of foo/bar/baz. | 175 // TODO(aa): Test sibling ordering of foo/bar/baz. |
| 176 | 176 |
| 177 view->close(); | 177 view->close(); |
| 178 } | 178 } |
| OLD | NEW |