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 SKY_SHELL_TESTING_TEST_RUNNER_H_ |
| 6 #define SKY_SHELL_TESTING_TEST_RUNNER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/common/weak_binding_set.h" |
| 13 #include "mojo/public/cpp/application/interface_factory_impl.h" |
| 14 #include "sky/services/testing/test_harness.mojom.h" |
| 15 #include "sky/services/viewport/viewport_observer.mojom.h" |
| 16 |
| 17 namespace sky { |
| 18 namespace shell { |
| 19 class ShellView; |
| 20 |
| 21 class TestRunner : public mojo::InterfaceFactory<TestHarness>, |
| 22 public TestHarness { |
| 23 public: |
| 24 static TestRunner& Shared(); |
| 25 |
| 26 void set_package_root(const std::string& package_root) { |
| 27 package_root_ = package_root; |
| 28 } |
| 29 |
| 30 void Start(const std::string& single_test_url); |
| 31 |
| 32 private: |
| 33 // mojo::InterfaceFactory<TestHarness> implementation: |
| 34 void Create(mojo::ApplicationConnection* app, |
| 35 mojo::InterfaceRequest<TestHarness> request) override; |
| 36 |
| 37 // TestHarness implementation: |
| 38 void OnTestComplete(const mojo::String& test_result, |
| 39 const mojo::Array<uint8_t> pixels) override; |
| 40 void DispatchInputEvent(mojo::EventPtr event) override; |
| 41 |
| 42 TestRunner(); |
| 43 ~TestRunner() override; |
| 44 void ScheduleRun(); |
| 45 void Run(); |
| 46 |
| 47 std::string package_root_; |
| 48 scoped_ptr<ShellView> shell_view_; |
| 49 ViewportObserverPtr viewport_observer_; |
| 50 |
| 51 std::string single_test_url_; |
| 52 mojo::WeakBindingSet<TestHarness> bindings_; |
| 53 |
| 54 base::WeakPtrFactory<TestRunner> weak_ptr_factory_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 57 }; |
| 58 |
| 59 } // namespace shell |
| 60 } // namespace sky |
| 61 |
| 62 #endif // SKY_SHELL_TESTING_TEST_RUNNER_H_ |
OLD | NEW |