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