| 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 #include "sky/tools/tester/test_runner.h" | 5 #include "sky/tools/tester/test_runner.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "mojo/public/cpp/application/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
| 10 #include "mojo/public/cpp/application/service_provider_impl.h" | |
| 11 #include "mojo/services/view_manager/public/cpp/view.h" | 10 #include "mojo/services/view_manager/public/cpp/view.h" |
| 12 | 11 |
| 13 namespace sky { | 12 namespace sky { |
| 14 namespace tester { | 13 namespace tester { |
| 15 | 14 |
| 16 TestRunnerClient::~TestRunnerClient() { | 15 TestRunnerClient::~TestRunnerClient() { |
| 17 } | 16 } |
| 18 | 17 |
| 19 TestRunner::TestRunner(TestRunnerClient* client, mojo::View* container, | 18 TestRunner::TestRunner(TestRunnerClient* client, mojo::View* container, |
| 20 const std::string& url, bool enable_pixel_dumping) | 19 const std::string& url, bool enable_pixel_dumping) |
| 21 : test_harness_factory_(this), | 20 : test_harness_factory_(this), |
| 22 client_(client), | 21 client_(client), |
| 23 weak_ptr_factory_(this), | 22 weak_ptr_factory_(this), |
| 24 enable_pixel_dumping_(enable_pixel_dumping) { | 23 enable_pixel_dumping_(enable_pixel_dumping) { |
| 25 CHECK(client); | 24 CHECK(client); |
| 26 | 25 |
| 27 scoped_ptr<mojo::ServiceProviderImpl> exported_services( | 26 mojo::ServiceProviderPtr test_harness_provider; |
| 28 new mojo::ServiceProviderImpl()); | 27 test_harness_provider_impl_.AddService(&test_harness_factory_); |
| 29 exported_services->AddService(&test_harness_factory_); | 28 test_harness_provider_impl_.Bind(GetProxy(&test_harness_provider)); |
| 30 | 29 |
| 31 container->Embed(url, exported_services.Pass()); | 30 container->Embed(url, nullptr, test_harness_provider.Pass()); |
| 32 } | 31 } |
| 33 | 32 |
| 34 TestRunner::~TestRunner() { | 33 TestRunner::~TestRunner() { |
| 35 } | 34 } |
| 36 | 35 |
| 37 base::WeakPtr<TestRunner> TestRunner::GetWeakPtr() { | 36 base::WeakPtr<TestRunner> TestRunner::GetWeakPtr() { |
| 38 return weak_ptr_factory_.GetWeakPtr(); | 37 return weak_ptr_factory_.GetWeakPtr(); |
| 39 } | 38 } |
| 40 | 39 |
| 41 void TestRunner::OnTestStart() { | 40 void TestRunner::OnTestStart() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 63 std::cout << "#EOF\n"; | 62 std::cout << "#EOF\n"; |
| 64 std::cout.flush(); | 63 std::cout.flush(); |
| 65 std::cerr << "#EOF\n"; | 64 std::cerr << "#EOF\n"; |
| 66 std::cerr.flush(); | 65 std::cerr.flush(); |
| 67 | 66 |
| 68 client_->OnTestComplete(); | 67 client_->OnTestComplete(); |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace tester | 70 } // namespace tester |
| 72 } // namespace sky | 71 } // namespace sky |
| OLD | NEW |