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/services/view_manager/public/cpp/view.h" | 10 #include "mojo/services/view_manager/public/cpp/view.h" |
11 | 11 |
12 namespace sky { | 12 namespace sky { |
13 namespace tester { | 13 namespace tester { |
14 | 14 |
15 TestRunnerClient::~TestRunnerClient() { | 15 TestRunnerClient::~TestRunnerClient() { |
16 } | 16 } |
17 | 17 |
18 TestRunner::TestRunner(TestRunnerClient* client, mojo::View* container, | 18 TestRunner::TestRunner(TestRunnerClient* client, |
19 const std::string& url, bool enable_pixel_dumping) | 19 mojo::View* container, |
20 : test_harness_factory_(this), | 20 const std::string& url, |
21 client_(client), | 21 bool enable_pixel_dumping) |
| 22 : client_(client), |
22 weak_ptr_factory_(this), | 23 weak_ptr_factory_(this), |
23 enable_pixel_dumping_(enable_pixel_dumping) { | 24 enable_pixel_dumping_(enable_pixel_dumping) { |
24 CHECK(client); | 25 CHECK(client); |
25 | 26 |
26 mojo::ServiceProviderPtr test_harness_provider; | 27 mojo::ServiceProviderPtr test_harness_provider; |
27 test_harness_provider_impl_.AddService(&test_harness_factory_); | 28 test_harness_provider_impl_.AddService(this); |
28 test_harness_provider_impl_.Bind(GetProxy(&test_harness_provider)); | 29 test_harness_provider_impl_.Bind(GetProxy(&test_harness_provider)); |
29 | 30 |
30 container->Embed(url, nullptr, test_harness_provider.Pass()); | 31 container->Embed(url, nullptr, test_harness_provider.Pass()); |
31 } | 32 } |
32 | 33 |
33 TestRunner::~TestRunner() { | 34 TestRunner::~TestRunner() { |
34 } | 35 } |
35 | 36 |
36 base::WeakPtr<TestRunner> TestRunner::GetWeakPtr() { | 37 base::WeakPtr<TestRunner> TestRunner::GetWeakPtr() { |
37 return weak_ptr_factory_.GetWeakPtr(); | 38 return weak_ptr_factory_.GetWeakPtr(); |
(...skipping 22 matching lines...) Expand all Loading... |
60 } | 61 } |
61 | 62 |
62 std::cout << "#EOF\n"; | 63 std::cout << "#EOF\n"; |
63 std::cout.flush(); | 64 std::cout.flush(); |
64 std::cerr << "#EOF\n"; | 65 std::cerr << "#EOF\n"; |
65 std::cerr.flush(); | 66 std::cerr.flush(); |
66 | 67 |
67 client_->OnTestComplete(); | 68 client_->OnTestComplete(); |
68 } | 69 } |
69 | 70 |
| 71 void TestRunner::Create(mojo::ApplicationConnection* app, |
| 72 mojo::InterfaceRequest<TestHarness> request) { |
| 73 new TestHarnessImpl(this, request.Pass()); |
| 74 } |
| 75 |
70 } // namespace tester | 76 } // namespace tester |
71 } // namespace sky | 77 } // namespace sky |
OLD | NEW |