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