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 "base/memory/scoped_ptr.h" |
| 10 #include "components/view_manager/public/cpp/view_tree_delegate.h" |
| 11 #include "components/view_manager/public/interfaces/view_tree_host.mojom.h" |
| 12 #include "components/web_view/public/cpp/web_view.h" |
| 13 #include "components/web_view/public/interfaces/web_view.mojom.h" |
| 14 #include "components/web_view/test_runner/public/interfaces/layout_test_runner.m
ojom.h" |
| 15 #include "mojo/application/public/cpp/application_delegate.h" |
| 16 #include "mojo/application/public/cpp/interface_factory.h" |
| 17 #include "mojo/common/weak_binding_set.h" |
| 18 |
| 19 class GURL; |
| 20 |
| 21 namespace mojo { |
| 22 class View; |
| 23 } |
| 24 |
| 25 namespace web_view { |
| 26 |
| 27 class TestRunnerApplicationDelegate |
| 28 : public mojo::ApplicationDelegate, |
| 29 public mojo::ViewTreeDelegate, |
| 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::ApplicationDelegate: |
| 42 void Initialize(mojo::ApplicationImpl* app) override; |
| 43 bool ConfigureIncomingConnection( |
| 44 mojo::ApplicationConnection* connection) override; |
| 45 |
| 46 // mojo::ViewTreeDelegate: |
| 47 void OnEmbed(mojo::View* root) override; |
| 48 void OnConnectionLost(mojo::ViewTreeConnection* connection) override; |
| 49 |
| 50 // mojom::WebViewClient: |
| 51 void TopLevelNavigate(mojo::URLRequestPtr request) override; |
| 52 void LoadingStateChanged(bool is_loading) override; |
| 53 void ProgressChanged(double progress) override; |
| 54 void TitleChanged(const mojo::String& title) override; |
| 55 |
| 56 // LayoutTestRunner: |
| 57 void TestFinished() override; |
| 58 |
| 59 // mojo::InterfaceFactory<LayoutTestRunner>: |
| 60 void Create(mojo::ApplicationConnection* connection, |
| 61 mojo::InterfaceRequest<LayoutTestRunner> request) override; |
| 62 |
| 63 mojo::ApplicationImpl* app_; |
| 64 mojo::ViewTreeHostPtr host_; |
| 65 |
| 66 mojo::View* root_; |
| 67 mojo::View* content_; |
| 68 scoped_ptr<WebView> web_view_; |
| 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 |