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 #include "sky/tools/tester/test_harness.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/message_loop/message_loop.h" | |
9 #include <iostream> | |
10 | |
11 namespace sky { | |
12 namespace tester { | |
13 namespace { | |
14 | |
15 std::string WaitForURL() { | |
16 std::string url; | |
17 std::cin >> url; | |
18 return url; | |
19 } | |
20 | |
21 } // namespace | |
22 | |
23 TestHarness::TestHarness(mojo::View* container) | |
24 : container_(container), | |
25 weak_ptr_factory_(this) { | |
26 std::cout << "#READY\n"; | |
27 std::cout.flush(); | |
28 } | |
29 | |
30 TestHarness::~TestHarness() { | |
31 } | |
32 | |
33 void TestHarness::ScheduleRun() { | |
34 base::MessageLoop::current()->PostTask(FROM_HERE, | |
35 base::Bind(&TestHarness::Run, weak_ptr_factory_.GetWeakPtr())); | |
36 } | |
37 | |
38 void TestHarness::Run() { | |
39 DCHECK(!test_runner_); | |
40 test_runner_.reset(new TestRunner(this, container_, WaitForURL())); | |
41 } | |
42 | |
43 void TestHarness::OnTestComplete() { | |
44 test_runner_.reset(); | |
45 ScheduleRun(); | |
46 } | |
47 | |
48 } // namespace tester | |
49 } // namespace sky | |
OLD | NEW |