| 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 "components/test_runner/test_interfaces.h" | 5 #include "components/test_runner/test_interfaces.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/json/string_escape.h" | 12 #include "base/json/string_escape.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "components/test_runner/app_banner_client.h" | 16 #include "components/test_runner/app_banner_client.h" |
| 17 #include "components/test_runner/gamepad_controller.h" | 17 #include "components/test_runner/gamepad_controller.h" |
| 18 #include "components/test_runner/gc_controller.h" | 18 #include "components/test_runner/gc_controller.h" |
| 19 #include "components/test_runner/test_runner.h" | 19 #include "components/test_runner/test_runner.h" |
| 20 #include "components/test_runner/text_input_controller.h" | 20 #include "components/test_runner/text_input_controller.h" |
| 21 #include "components/test_runner/web_test_proxy.h" | 21 #include "components/test_runner/web_view_test_proxy.h" |
| 22 #include "third_party/WebKit/public/platform/WebURL.h" | 22 #include "third_party/WebKit/public/platform/WebURL.h" |
| 23 #include "third_party/WebKit/public/web/WebCache.h" | 23 #include "third_party/WebKit/public/web/WebCache.h" |
| 24 #include "third_party/WebKit/public/web/WebKit.h" | 24 #include "third_party/WebKit/public/web/WebKit.h" |
| 25 #include "third_party/WebKit/public/web/WebView.h" | 25 #include "third_party/WebKit/public/web/WebView.h" |
| 26 | 26 |
| 27 namespace test_runner { | 27 namespace test_runner { |
| 28 | 28 |
| 29 TestInterfaces::TestInterfaces() | 29 TestInterfaces::TestInterfaces() |
| 30 : test_runner_(new TestRunner(this)), | 30 : test_runner_(new TestRunner(this)), |
| 31 delegate_(nullptr), | 31 delegate_(nullptr), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 62 if (gamepad_controller_) | 62 if (gamepad_controller_) |
| 63 gamepad_controller_->Install(frame); | 63 gamepad_controller_->Install(frame); |
| 64 GCController::Install(frame); | 64 GCController::Install(frame); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void TestInterfaces::ResetTestHelperControllers() { | 67 void TestInterfaces::ResetTestHelperControllers() { |
| 68 if (gamepad_controller_) | 68 if (gamepad_controller_) |
| 69 gamepad_controller_->Reset(); | 69 gamepad_controller_->Reset(); |
| 70 blink::WebCache::clear(); | 70 blink::WebCache::clear(); |
| 71 | 71 |
| 72 for (WebTestProxyBase* web_test_proxy_base : window_list_) | 72 for (WebViewTestProxyBase* web_view_test_proxy_base : window_list_) |
| 73 web_test_proxy_base->Reset(); | 73 web_view_test_proxy_base->Reset(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void TestInterfaces::ResetAll() { | 76 void TestInterfaces::ResetAll() { |
| 77 ResetTestHelperControllers(); | 77 ResetTestHelperControllers(); |
| 78 test_runner_->Reset(); | 78 test_runner_->Reset(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void TestInterfaces::SetTestIsRunning(bool running) { | 81 void TestInterfaces::SetTestIsRunning(bool running) { |
| 82 test_runner_->SetTestIsRunning(running); | 82 test_runner_->SetTestIsRunning(running); |
| 83 } | 83 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 114 } | 114 } |
| 115 if (spec.find("/imported/wpt/") != std::string::npos || | 115 if (spec.find("/imported/wpt/") != std::string::npos || |
| 116 spec.find("/imported/csswg-test/") != std::string::npos) | 116 spec.find("/imported/csswg-test/") != std::string::npos) |
| 117 test_runner_->set_is_web_platform_tests_mode(); | 117 test_runner_->set_is_web_platform_tests_mode(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void TestInterfaces::SetAppBannerClient(AppBannerClient* app_banner_client) { | 120 void TestInterfaces::SetAppBannerClient(AppBannerClient* app_banner_client) { |
| 121 app_banner_client_ = app_banner_client; | 121 app_banner_client_ = app_banner_client; |
| 122 } | 122 } |
| 123 | 123 |
| 124 void TestInterfaces::WindowOpened(WebTestProxyBase* proxy) { | 124 void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) { |
| 125 window_list_.push_back(proxy); | 125 window_list_.push_back(proxy); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void TestInterfaces::WindowClosed(WebTestProxyBase* proxy) { | 128 void TestInterfaces::WindowClosed(WebViewTestProxyBase* proxy) { |
| 129 std::vector<WebTestProxyBase*>::iterator pos = | 129 std::vector<WebViewTestProxyBase*>::iterator pos = |
| 130 std::find(window_list_.begin(), window_list_.end(), proxy); | 130 std::find(window_list_.begin(), window_list_.end(), proxy); |
| 131 if (pos == window_list_.end()) { | 131 if (pos == window_list_.end()) { |
| 132 NOTREACHED(); | 132 NOTREACHED(); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 window_list_.erase(pos); | 135 window_list_.erase(pos); |
| 136 | 136 |
| 137 if (proxy->web_view() == main_view_) | 137 if (proxy->web_view() == main_view_) |
| 138 SetMainView(nullptr); | 138 SetMainView(nullptr); |
| 139 } | 139 } |
| 140 | 140 |
| 141 TestRunner* TestInterfaces::GetTestRunner() { | 141 TestRunner* TestInterfaces::GetTestRunner() { |
| 142 return test_runner_.get(); | 142 return test_runner_.get(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 WebTestDelegate* TestInterfaces::GetDelegate() { | 145 WebTestDelegate* TestInterfaces::GetDelegate() { |
| 146 return delegate_; | 146 return delegate_; |
| 147 } | 147 } |
| 148 | 148 |
| 149 const std::vector<WebTestProxyBase*>& TestInterfaces::GetWindowList() { | 149 const std::vector<WebViewTestProxyBase*>& TestInterfaces::GetWindowList() { |
| 150 return window_list_; | 150 return window_list_; |
| 151 } | 151 } |
| 152 | 152 |
| 153 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { | 153 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { |
| 154 if (!test_runner_->UseMockTheme()) | 154 if (!test_runner_->UseMockTheme()) |
| 155 return 0; | 155 return 0; |
| 156 if (!theme_engine_.get()) | 156 if (!theme_engine_.get()) |
| 157 theme_engine_.reset(new MockWebThemeEngine()); | 157 theme_engine_.reset(new MockWebThemeEngine()); |
| 158 return theme_engine_.get(); | 158 return theme_engine_.get(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 AppBannerClient* TestInterfaces::GetAppBannerClient() { | 161 AppBannerClient* TestInterfaces::GetAppBannerClient() { |
| 162 return app_banner_client_; | 162 return app_banner_client_; |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace test_runner | 165 } // namespace test_runner |
| OLD | NEW |