OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_ | |
6 #define COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/command_line.h" | |
11 #include "base/macros.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "components/mus/public/cpp/window_tree_delegate.h" | |
14 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | |
15 #include "components/test_runner/test_info_extractor.h" | |
16 #include "components/web_view/public/cpp/web_view.h" | |
17 #include "components/web_view/public/interfaces/web_view.mojom.h" | |
18 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m
ojom.h" | |
19 #include "mojo/common/weak_binding_set.h" | |
20 #include "mojo/shell/public/cpp/interface_factory.h" | |
21 #include "mojo/shell/public/cpp/shell_client.h" | |
22 | |
23 class GURL; | |
24 | |
25 namespace web_view { | |
26 | |
27 class TestRunnerApplicationDelegate | |
28 : public mojo::ShellClient, | |
29 public mus::WindowTreeDelegate, | |
30 public mojom::WebViewClient, | |
31 public LayoutTestRunner, | |
32 public mojo::InterfaceFactory<LayoutTestRunner> { | |
33 public: | |
34 TestRunnerApplicationDelegate(); | |
35 ~TestRunnerApplicationDelegate() override; | |
36 | |
37 private: | |
38 void LaunchURL(const GURL& test_url); | |
39 void Terminate(); | |
40 | |
41 // mojo::ShellClient: | |
42 void Initialize(mojo::Shell* shell, const std::string& url, | |
43 uint32_t id) override; | |
44 bool AcceptConnection(mojo::Connection* connection) override; | |
45 | |
46 // mus::WindowTreeDelegate: | |
47 void OnEmbed(mus::Window* root) override; | |
48 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | |
49 | |
50 // mojom::WebViewClient: | |
51 void TopLevelNavigateRequest(mojo::URLRequestPtr request) override; | |
52 void TopLevelNavigationStarted(const mojo::String& url) override; | |
53 void LoadingStateChanged(bool is_loading, double progress) override; | |
54 void BackForwardChanged(mojom::ButtonState back_button, | |
55 mojom::ButtonState forward_button) override; | |
56 void TitleChanged(const mojo::String& title) override; | |
57 void FindInPageMatchCountUpdated(int32_t request_id, | |
58 int32_t count, | |
59 bool final_update) override {} | |
60 void FindInPageSelectionUpdated(int32_t request_id, | |
61 int32_t active_match_ordinal) override {} | |
62 | |
63 // LayoutTestRunner: | |
64 void TestFinished() override; | |
65 | |
66 // mojo::InterfaceFactory<LayoutTestRunner>: | |
67 void Create(mojo::Connection* connection, | |
68 mojo::InterfaceRequest<LayoutTestRunner> request) override; | |
69 | |
70 mojo::Shell* shell_; | |
71 mus::mojom::WindowTreeHostPtr host_; | |
72 | |
73 mus::Window* root_; | |
74 mus::Window* content_; | |
75 scoped_ptr<WebView> web_view_; | |
76 | |
77 scoped_ptr<test_runner::TestInfoExtractor> test_extractor_; | |
78 | |
79 mojo::WeakBindingSet<LayoutTestRunner> layout_test_runner_; | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(TestRunnerApplicationDelegate); | |
82 }; | |
83 | |
84 } // namespace web_view | |
85 | |
86 #endif // COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_ | |
OLD | NEW |