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/shell/testing/test_runner.h" | 5 #include "sky/shell/testing/test_runner.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const char kFileUrlPrefix[] = "file://"; | 53 const char kFileUrlPrefix[] = "file://"; |
54 static TestRunner* g_test_runner = nullptr; | 54 static TestRunner* g_test_runner = nullptr; |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 TestRunner::TestRunner() | 58 TestRunner::TestRunner() |
59 : shell_view_(new ShellView(Shell::Shared())), | 59 : shell_view_(new ShellView(Shell::Shared())), |
60 weak_ptr_factory_(this) { | 60 weak_ptr_factory_(this) { |
61 CHECK(!g_test_runner) << "Only create one TestRunner."; | 61 CHECK(!g_test_runner) << "Only create one TestRunner."; |
62 | 62 |
63 shell_view_->view()->ConnectToViewportObserver(GetProxy(&viewport_observer_)); | 63 shell_view_->view()->ConnectToEngine(GetProxy(&sky_engine_)); |
64 viewport_observer_->OnViewportMetricsChanged(320, 640, 1.0); | 64 sky_engine_->OnViewportMetricsChanged(320, 640, 1.0); |
65 } | 65 } |
66 | 66 |
67 TestRunner::~TestRunner() { | 67 TestRunner::~TestRunner() { |
68 } | 68 } |
69 | 69 |
70 TestRunner& TestRunner::Shared() { | 70 TestRunner& TestRunner::Shared() { |
71 if (!g_test_runner) | 71 if (!g_test_runner) |
72 g_test_runner = new TestRunner(); | 72 g_test_runner = new TestRunner(); |
73 return *g_test_runner; | 73 return *g_test_runner; |
74 } | 74 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 data.url = single_test_url_; | 114 data.url = single_test_url_; |
115 } else { | 115 } else { |
116 WaitForURL(data); | 116 WaitForURL(data); |
117 } | 117 } |
118 | 118 |
119 std::cout << "#BEGIN\n"; | 119 std::cout << "#BEGIN\n"; |
120 std::cout.flush(); | 120 std::cout.flush(); |
121 | 121 |
122 if (StartsWithASCII(data.url, kFileUrlPrefix, true)) | 122 if (StartsWithASCII(data.url, kFileUrlPrefix, true)) |
123 ReplaceFirstSubstringAfterOffset(&data.url, 0, kFileUrlPrefix, ""); | 123 ReplaceFirstSubstringAfterOffset(&data.url, 0, kFileUrlPrefix, ""); |
124 viewport_observer_->RunFromFile(data.url, package_root_); | 124 sky_engine_->RunFromFile(data.url, package_root_); |
125 } | 125 } |
126 | 126 |
127 } // namespace shell | 127 } // namespace shell |
128 } // namespace sky | 128 } // namespace sky |
OLD | NEW |