blob: 6addcaeeadf564abd208799171803e93ad2f1d62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_
#define COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "components/mus/public/cpp/view_tree_delegate.h"
#include "components/mus/public/interfaces/view_tree_host.mojom.h"
#include "components/test_runner/test_info_extractor.h"
#include "components/web_view/public/cpp/web_view.h"
#include "components/web_view/public/interfaces/web_view.mojom.h"
#include "components/web_view/test_runner/public/interfaces/layout_test_runner.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/common/weak_binding_set.h"
class GURL;
namespace mojo {
class View;
}
namespace web_view {
class TestRunnerApplicationDelegate
: public mojo::ApplicationDelegate,
public mus::ViewTreeDelegate,
public mojom::WebViewClient,
public LayoutTestRunner,
public mojo::InterfaceFactory<LayoutTestRunner> {
public:
TestRunnerApplicationDelegate();
~TestRunnerApplicationDelegate() override;
private:
void LaunchURL(const GURL& test_url);
void Terminate();
// mojo::ApplicationDelegate:
void Initialize(mojo::ApplicationImpl* app) override;
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
// mus::ViewTreeDelegate:
void OnEmbed(mus::View* root) override;
void OnConnectionLost(mus::ViewTreeConnection* connection) override;
// mojom::WebViewClient:
void TopLevelNavigate(mojo::URLRequestPtr request) override;
void LoadingStateChanged(bool is_loading) override;
void ProgressChanged(double progress) override;
void BackForwardChanged(mojom::ButtonState back_button,
mojom::ButtonState forward_button) override;
void TitleChanged(const mojo::String& title) override;
// LayoutTestRunner:
void TestFinished() override;
// mojo::InterfaceFactory<LayoutTestRunner>:
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<LayoutTestRunner> request) override;
mojo::ApplicationImpl* app_;
mojo::ViewTreeHostPtr host_;
mus::View* root_;
mus::View* content_;
scoped_ptr<WebView> web_view_;
scoped_ptr<test_runner::TestInfoExtractor> test_extractor_;
mojo::WeakBindingSet<LayoutTestRunner> layout_test_runner_;
DISALLOW_COPY_AND_ASSIGN(TestRunnerApplicationDelegate);
};
} // namespace web_view
#endif // COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_
|