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