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 "components/html_viewer/layout_test_html_viewer.h" | 5 #include "components/html_viewer/layout_test_html_viewer.h" |
6 | 6 |
7 #include "components/html_viewer/global_state.h" | 7 #include "components/html_viewer/global_state.h" |
8 #include "components/html_viewer/layout_test_content_handler_impl.h" | 8 #include "components/html_viewer/layout_test_content_handler_impl.h" |
9 #include "components/test_runner/web_test_interfaces.h" | 9 #include "components/test_runner/web_test_interfaces.h" |
| 10 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m
ojom.h" |
10 | 11 |
11 namespace html_viewer { | 12 namespace html_viewer { |
12 | 13 |
13 LayoutTestHTMLViewer::LayoutTestHTMLViewer() { | 14 LayoutTestHTMLViewer::LayoutTestHTMLViewer() { |
14 } | 15 } |
15 | 16 |
16 LayoutTestHTMLViewer::~LayoutTestHTMLViewer() { | 17 LayoutTestHTMLViewer::~LayoutTestHTMLViewer() { |
17 } | 18 } |
18 | 19 |
19 void LayoutTestHTMLViewer::Initialize(mojo::ApplicationImpl* app) { | 20 void LayoutTestHTMLViewer::Initialize(mojo::ApplicationImpl* app) { |
20 HTMLViewer::Initialize(app); | 21 HTMLViewer::Initialize(app); |
21 global_state()->InitIfNecessary(gfx::Size(800, 600), 1.f); | 22 global_state()->InitIfNecessary(gfx::Size(800, 600), 1.f); |
22 test_interfaces_.reset(new test_runner::WebTestInterfaces); | 23 test_interfaces_.reset(new test_runner::WebTestInterfaces); |
23 test_interfaces_->ResetAll(); | 24 test_interfaces_->ResetAll(); |
24 test_delegate_.set_test_interfaces(test_interfaces_.get()); | 25 test_delegate_.set_test_interfaces(test_interfaces_.get()); |
| 26 test_delegate_.set_completion_callback( |
| 27 base::Bind(&LayoutTestHTMLViewer::TestFinished, base::Unretained(this))); |
25 test_interfaces_->SetDelegate(&test_delegate_); | 28 test_interfaces_->SetDelegate(&test_delegate_); |
26 } | 29 } |
27 | 30 |
| 31 void LayoutTestHTMLViewer::TestFinished() { |
| 32 web_view::LayoutTestRunnerPtr test_runner_ptr; |
| 33 |
| 34 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 35 request->url = mojo::String::From("mojo:web_view_test_runner"); |
| 36 app()->ConnectToService(request.Pass(), &test_runner_ptr); |
| 37 test_runner_ptr->TestFinished(); |
| 38 } |
| 39 |
28 void LayoutTestHTMLViewer::Create( | 40 void LayoutTestHTMLViewer::Create( |
29 mojo::ApplicationConnection* connection, | 41 mojo::ApplicationConnection* connection, |
30 mojo::InterfaceRequest<mojo::ContentHandler> request) { | 42 mojo::InterfaceRequest<mojo::ContentHandler> request) { |
31 new LayoutTestContentHandlerImpl(global_state(), app(), request.Pass(), | 43 new LayoutTestContentHandlerImpl(global_state(), app(), request.Pass(), |
32 test_interfaces_.get(), | 44 test_interfaces_.get(), |
33 &test_delegate_); | 45 &test_delegate_); |
34 } | 46 } |
35 | 47 |
36 } // namespace html_viewer | 48 } // namespace html_viewer |
OLD | NEW |