// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_ #define COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_ #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "components/mus/public/cpp/view_tree_delegate.h" #include "components/mus/public/interfaces/view_tree_host.mojom.h" #include "components/test_runner/test_info_extractor.h" #include "components/web_view/public/cpp/web_view.h" #include "components/web_view/public/interfaces/web_view.mojom.h" #include "components/web_view/test_runner/public/interfaces/layout_test_runner.mojom.h" #include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/interface_factory.h" #include "mojo/common/weak_binding_set.h" class GURL; namespace mojo { class View; } namespace web_view { class TestRunnerApplicationDelegate : public mojo::ApplicationDelegate, public mus::ViewTreeDelegate, public mojom::WebViewClient, public LayoutTestRunner, public mojo::InterfaceFactory { public: TestRunnerApplicationDelegate(); ~TestRunnerApplicationDelegate() override; private: void LaunchURL(const GURL& test_url); void Terminate(); // mojo::ApplicationDelegate: void Initialize(mojo::ApplicationImpl* app) override; bool ConfigureIncomingConnection( mojo::ApplicationConnection* connection) override; // mus::ViewTreeDelegate: void OnEmbed(mus::View* root) override; void OnConnectionLost(mus::ViewTreeConnection* connection) override; // mojom::WebViewClient: void TopLevelNavigate(mojo::URLRequestPtr request) override; void LoadingStateChanged(bool is_loading) override; void ProgressChanged(double progress) override; void BackForwardChanged(mojom::ButtonState back_button, mojom::ButtonState forward_button) override; void TitleChanged(const mojo::String& title) override; // LayoutTestRunner: void TestFinished() override; // mojo::InterfaceFactory: void Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest request) override; mojo::ApplicationImpl* app_; mojo::ViewTreeHostPtr host_; mus::View* root_; mus::View* content_; scoped_ptr web_view_; scoped_ptr test_extractor_; mojo::WeakBindingSet layout_test_runner_; DISALLOW_COPY_AND_ASSIGN(TestRunnerApplicationDelegate); }; } // namespace web_view #endif // COMPONENTS_WEB_VIEW__TEST_RUNNER_TEST_RUNNER_APPLICATION_DELEGATE_H_