Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: components/html_viewer/layout_test_html_viewer.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "components/html_viewer/global_state.h" 9 #include "components/html_viewer/global_state.h"
10 #include "components/html_viewer/layout_test_content_handler_impl.h" 10 #include "components/html_viewer/layout_test_content_handler_impl.h"
11 #include "components/test_runner/web_test_interfaces.h" 11 #include "components/test_runner/web_test_interfaces.h"
12 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m ojom.h" 12 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m ojom.h"
13 #include "v8/include/v8.h" 13 #include "v8/include/v8.h"
14 14
15 namespace html_viewer { 15 namespace html_viewer {
16 16
17 LayoutTestHTMLViewer::LayoutTestHTMLViewer() { 17 LayoutTestHTMLViewer::LayoutTestHTMLViewer() {
18 } 18 }
19 19
20 LayoutTestHTMLViewer::~LayoutTestHTMLViewer() { 20 LayoutTestHTMLViewer::~LayoutTestHTMLViewer() {
21 } 21 }
22 22
23 void LayoutTestHTMLViewer::Initialize(mojo::ApplicationImpl* app) { 23 void LayoutTestHTMLViewer::Initialize(mojo::Shell* shell,
24 HTMLViewer::Initialize(app); 24 const std::string& url, uint32_t id) {
25 HTMLViewer::Initialize(shell, url, id);
25 global_state()->InitIfNecessary(gfx::Size(800, 600), 1.f); 26 global_state()->InitIfNecessary(gfx::Size(800, 600), 1.f);
26 test_interfaces_.reset(new test_runner::WebTestInterfaces); 27 test_interfaces_.reset(new test_runner::WebTestInterfaces);
27 test_interfaces_->ResetAll(); 28 test_interfaces_->ResetAll();
28 test_delegate_.set_test_interfaces(test_interfaces_.get()); 29 test_delegate_.set_test_interfaces(test_interfaces_.get());
29 test_delegate_.set_completion_callback( 30 test_delegate_.set_completion_callback(
30 base::Bind(&LayoutTestHTMLViewer::TestFinished, base::Unretained(this))); 31 base::Bind(&LayoutTestHTMLViewer::TestFinished, base::Unretained(this)));
31 test_interfaces_->SetDelegate(&test_delegate_); 32 test_interfaces_->SetDelegate(&test_delegate_);
32 33
33 // Always expose GC to layout tests. 34 // Always expose GC to layout tests.
34 std::string flags("--expose-gc"); 35 std::string flags("--expose-gc");
35 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 36 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
36 } 37 }
37 38
38 void LayoutTestHTMLViewer::TestFinished() { 39 void LayoutTestHTMLViewer::TestFinished() {
39 test_interfaces_->ResetAll(); 40 test_interfaces_->ResetAll();
40 41
41 web_view::LayoutTestRunnerPtr test_runner_ptr; 42 web_view::LayoutTestRunnerPtr test_runner_ptr;
42 app()->ConnectToService("mojo:web_view_test_runner", &test_runner_ptr); 43 shell()->ConnectToService("mojo:web_view_test_runner", &test_runner_ptr);
43 test_runner_ptr->TestFinished(); 44 test_runner_ptr->TestFinished();
44 } 45 }
45 46
46 void LayoutTestHTMLViewer::Create( 47 void LayoutTestHTMLViewer::Create(
47 mojo::ApplicationConnection* connection, 48 mojo::ApplicationConnection* connection,
48 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) { 49 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> request) {
49 new LayoutTestContentHandlerImpl(global_state(), app(), std::move(request), 50 new LayoutTestContentHandlerImpl(global_state(), shell(), std::move(request),
50 test_interfaces_.get(), &test_delegate_); 51 test_interfaces_.get(), &test_delegate_);
51 } 52 }
52 53
53 } // namespace html_viewer 54 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/layout_test_html_viewer.h ('k') | components/html_viewer/media_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698