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 "base/command_line.h" |
| 9 #include "components/view_manager/public/cpp/view_tree_delegate.h" |
| 10 #include "components/view_manager/public/interfaces/view_tree_host.mojom.h" |
| 11 #include "components/web_view/public/cpp/web_view.h" |
| 12 #include "components/web_view/public/interfaces/web_view.mojom.h" |
| 13 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m
ojom.h" |
| 14 #include "mojo/application/public/cpp/application_delegate.h" |
| 15 #include "mojo/application/public/cpp/interface_factory.h" |
| 16 #include "mojo/common/weak_binding_set.h" |
| 17 |
| 18 class GURL; |
| 19 |
| 20 namespace mojo { |
| 21 class View; |
| 22 } |
| 23 |
| 24 namespace web_view { |
| 25 |
| 26 class TestRunnerApplicationDelegate |
| 27 : public mojo::ApplicationDelegate, |
| 28 public mojo::ViewTreeDelegate, |
| 29 public mojom::WebViewClient, |
| 30 public LayoutTestRunner, |
| 31 public mojo::InterfaceFactory<LayoutTestRunner> { |
| 32 public: |
| 33 TestRunnerApplicationDelegate(); |
| 34 ~TestRunnerApplicationDelegate() override; |
| 35 |
| 36 private: |
| 37 void LaunchURL(const GURL& test_url); |
| 38 void Terminate(); |
| 39 |
| 40 // mojo::ApplicationDelegate: |
| 41 void Initialize(mojo::ApplicationImpl* app) override; |
| 42 bool ConfigureIncomingConnection( |
| 43 mojo::ApplicationConnection* connection) override; |
| 44 |
| 45 // mojo::ViewTreeDelegate: |
| 46 void OnEmbed(mojo::View* root) override; |
| 47 void OnConnectionLost(mojo::ViewTreeConnection* connection) override; |
| 48 |
| 49 // mojom::WebViewClient: |
| 50 void TopLevelNavigate(mojo::URLRequestPtr request) override; |
| 51 void LoadingStateChanged(bool is_loading) override; |
| 52 void ProgressChanged(double progress) override; |
| 53 void TitleChanged(const mojo::String& title) override; |
| 54 |
| 55 // LayoutTestRunner: |
| 56 void TestFinished() override; |
| 57 |
| 58 // mojo::InterfaceFactory<LayoutTestRunner>: |
| 59 void Create(mojo::ApplicationConnection* connection, |
| 60 mojo::InterfaceRequest<LayoutTestRunner> request) override; |
| 61 |
| 62 mojo::ApplicationImpl* app_; |
| 63 mojo::ViewTreeHostPtr host_; |
| 64 |
| 65 mojo::View* root_; |
| 66 mojo::View* content_; |
| 67 WebView web_view_; |
| 68 bool web_view_inited_; |
| 69 |
| 70 base::CommandLine::StringVector cmdline_args_; |
| 71 size_t cmdline_position_; |
| 72 |
| 73 mojo::WeakBindingSet<LayoutTestRunner> layout_test_runner_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(TestRunnerApplicationDelegate); |
| 76 }; |
| 77 |
| 78 } // namespace web_view |
| 79 |
| 80 #endif // COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_ |
OLD | NEW |