| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SKY_TOOLS_TESTER_TEST_RUNNER_H_ | 5 #ifndef SKY_TOOLS_TESTER_TEST_RUNNER_H_ |
| 6 #define SKY_TOOLS_TESTER_TEST_RUNNER_H_ | 6 #define SKY_TOOLS_TESTER_TEST_RUNNER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "mojo/public/cpp/application/service_provider_impl.h" | 9 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 10 #include "sky/tools/tester/test_harness_impl.h" | 10 #include "sky/tools/tester/test_harness_impl.h" |
| 11 | 11 |
| 12 namespace mojo{ | 12 namespace mojo{ |
| 13 class View; | 13 class View; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace sky { | 16 namespace sky { |
| 17 namespace tester { | 17 namespace tester { |
| 18 | 18 |
| 19 class TestRunnerClient { | 19 class TestRunnerClient { |
| 20 public: | 20 public: |
| 21 virtual void OnTestComplete() = 0; | 21 virtual void OnTestComplete() = 0; |
| 22 virtual void DispatchInputEvent(mojo::EventPtr event) = 0; | 22 virtual void DispatchInputEvent(mojo::EventPtr event) = 0; |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual ~TestRunnerClient(); | 25 virtual ~TestRunnerClient(); |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class TestRunner { | 28 class TestRunner : public mojo::InterfaceFactory<TestHarness> { |
| 29 public: | 29 public: |
| 30 TestRunner(TestRunnerClient* client, mojo::View* container, | 30 TestRunner(TestRunnerClient* client, mojo::View* container, |
| 31 const std::string& url, bool enable_pixel_dumping); | 31 const std::string& url, bool enable_pixel_dumping); |
| 32 virtual ~TestRunner(); | 32 ~TestRunner() override; |
| 33 | 33 |
| 34 TestRunnerClient* client() const { return client_; } | 34 TestRunnerClient* client() const { return client_; } |
| 35 TestHarnessFactory* test_harness_factory() { return &test_harness_factory_; } | |
| 36 | 35 |
| 37 base::WeakPtr<TestRunner> GetWeakPtr(); | 36 base::WeakPtr<TestRunner> GetWeakPtr(); |
| 38 void OnTestStart(); | 37 void OnTestStart(); |
| 39 void OnTestComplete(const std::string& test_result, | 38 void OnTestComplete(const std::string& test_result, |
| 40 const mojo::Array<uint8_t>& pixels); | 39 const mojo::Array<uint8_t>& pixels); |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 TestHarnessFactory test_harness_factory_; | 42 // mojo::InterfaceFactory<TestHarness> implementation: |
| 43 void Create(mojo::ApplicationConnection* app, |
| 44 mojo::InterfaceRequest<TestHarness> request) override; |
| 45 |
| 44 mojo::ServiceProviderImpl test_harness_provider_impl_; | 46 mojo::ServiceProviderImpl test_harness_provider_impl_; |
| 45 TestRunnerClient* client_; | 47 TestRunnerClient* client_; |
| 46 base::WeakPtrFactory<TestRunner> weak_ptr_factory_; | 48 base::WeakPtrFactory<TestRunner> weak_ptr_factory_; |
| 47 bool enable_pixel_dumping_; | 49 bool enable_pixel_dumping_; |
| 48 | 50 |
| 49 MOJO_DISALLOW_COPY_AND_ASSIGN(TestRunner); | 51 MOJO_DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 } // namespace tester | 54 } // namespace tester |
| 53 } // namespace sky | 55 } // namespace sky |
| 54 | 56 |
| 55 #endif // SKY_TOOLS_TESTER_TEST_RUNNER_H_ | 57 #endif // SKY_TOOLS_TESTER_TEST_RUNNER_H_ |
| OLD | NEW |