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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()->ConnectToEngine(GetProxy(&sky_engine_)); | 63 shell_view_->view()->ConnectToEngine(GetProxy(&sky_engine_)); |
64 sky_engine_->OnViewportMetricsChanged(320, 640, 1.0); | 64 ViewportMetricsPtr metrics = ViewportMetrics::New(); |
| 65 metrics->physical_width = 320; |
| 66 metrics->physical_height = 640; |
| 67 sky_engine_->OnViewportMetricsChanged(metrics.Pass()); |
65 } | 68 } |
66 | 69 |
67 TestRunner::~TestRunner() { | 70 TestRunner::~TestRunner() { |
68 } | 71 } |
69 | 72 |
70 TestRunner& TestRunner::Shared() { | 73 TestRunner& TestRunner::Shared() { |
71 if (!g_test_runner) | 74 if (!g_test_runner) |
72 g_test_runner = new TestRunner(); | 75 g_test_runner = new TestRunner(); |
73 return *g_test_runner; | 76 return *g_test_runner; |
74 } | 77 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 std::cout << "#BEGIN\n"; | 122 std::cout << "#BEGIN\n"; |
120 std::cout.flush(); | 123 std::cout.flush(); |
121 | 124 |
122 if (StartsWithASCII(data.url, kFileUrlPrefix, true)) | 125 if (StartsWithASCII(data.url, kFileUrlPrefix, true)) |
123 ReplaceFirstSubstringAfterOffset(&data.url, 0, kFileUrlPrefix, ""); | 126 ReplaceFirstSubstringAfterOffset(&data.url, 0, kFileUrlPrefix, ""); |
124 sky_engine_->RunFromFile(data.url, package_root_); | 127 sky_engine_->RunFromFile(data.url, package_root_); |
125 } | 128 } |
126 | 129 |
127 } // namespace shell | 130 } // namespace shell |
128 } // namespace sky | 131 } // namespace sky |
OLD | NEW |