| 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" | |
| 17 #include "components/test_runner/gamepad_controller.h" | 16 #include "components/test_runner/gamepad_controller.h" |
| 18 #include "components/test_runner/gc_controller.h" | 17 #include "components/test_runner/gc_controller.h" |
| 19 #include "components/test_runner/test_runner.h" | 18 #include "components/test_runner/test_runner.h" |
| 20 #include "components/test_runner/text_input_controller.h" | 19 #include "components/test_runner/text_input_controller.h" |
| 21 #include "components/test_runner/web_view_test_proxy.h" | 20 #include "components/test_runner/web_view_test_proxy.h" |
| 22 #include "third_party/WebKit/public/platform/WebURL.h" | 21 #include "third_party/WebKit/public/platform/WebURL.h" |
| 23 #include "third_party/WebKit/public/web/WebCache.h" | 22 #include "third_party/WebKit/public/web/WebCache.h" |
| 24 #include "third_party/WebKit/public/web/WebKit.h" | 23 #include "third_party/WebKit/public/web/WebKit.h" |
| 25 #include "third_party/WebKit/public/web/WebView.h" | 24 #include "third_party/WebKit/public/web/WebView.h" |
| 26 | 25 |
| 27 namespace test_runner { | 26 namespace test_runner { |
| 28 | 27 |
| 29 TestInterfaces::TestInterfaces() | 28 TestInterfaces::TestInterfaces() |
| 30 : test_runner_(new TestRunner(this)), | 29 : test_runner_(new TestRunner(this)), |
| 31 delegate_(nullptr), | 30 delegate_(nullptr), |
| 32 app_banner_client_(nullptr), | |
| 33 main_view_(nullptr) { | 31 main_view_(nullptr) { |
| 34 blink::setLayoutTestMode(true); | 32 blink::setLayoutTestMode(true); |
| 35 // NOTE: please don't put feature specific enable flags here, | 33 // NOTE: please don't put feature specific enable flags here, |
| 36 // instead add them to RuntimeEnabledFeatures.in | 34 // instead add them to RuntimeEnabledFeatures.in |
| 37 | 35 |
| 38 ResetAll(); | 36 ResetAll(); |
| 39 } | 37 } |
| 40 | 38 |
| 41 TestInterfaces::~TestInterfaces() { | 39 TestInterfaces::~TestInterfaces() { |
| 42 // gamepad_controller_ doesn't depend on WebView. | 40 // gamepad_controller_ doesn't depend on WebView. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 test_runner_->setShouldEnableViewSource(true); | 109 test_runner_->setShouldEnableViewSource(true); |
| 112 test_runner_->setShouldGeneratePixelResults(false); | 110 test_runner_->setShouldGeneratePixelResults(false); |
| 113 test_runner_->setShouldDumpAsMarkup(true); | 111 test_runner_->setShouldDumpAsMarkup(true); |
| 114 } | 112 } |
| 115 if (spec.find("/imported/wpt/") != std::string::npos || | 113 if (spec.find("/imported/wpt/") != std::string::npos || |
| 116 spec.find("/imported/csswg-test/") != std::string::npos || | 114 spec.find("/imported/csswg-test/") != std::string::npos || |
| 117 spec.find("://web-platform.test") != std::string::npos) | 115 spec.find("://web-platform.test") != std::string::npos) |
| 118 test_runner_->set_is_web_platform_tests_mode(); | 116 test_runner_->set_is_web_platform_tests_mode(); |
| 119 } | 117 } |
| 120 | 118 |
| 121 void TestInterfaces::SetAppBannerClient(AppBannerClient* app_banner_client) { | |
| 122 app_banner_client_ = app_banner_client; | |
| 123 } | |
| 124 | |
| 125 void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) { | 119 void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) { |
| 126 window_list_.push_back(proxy); | 120 window_list_.push_back(proxy); |
| 127 } | 121 } |
| 128 | 122 |
| 129 void TestInterfaces::WindowClosed(WebViewTestProxyBase* proxy) { | 123 void TestInterfaces::WindowClosed(WebViewTestProxyBase* proxy) { |
| 130 std::vector<WebViewTestProxyBase*>::iterator pos = | 124 std::vector<WebViewTestProxyBase*>::iterator pos = |
| 131 std::find(window_list_.begin(), window_list_.end(), proxy); | 125 std::find(window_list_.begin(), window_list_.end(), proxy); |
| 132 if (pos == window_list_.end()) { | 126 if (pos == window_list_.end()) { |
| 133 NOTREACHED(); | 127 NOTREACHED(); |
| 134 return; | 128 return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 152 } | 146 } |
| 153 | 147 |
| 154 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { | 148 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { |
| 155 if (!test_runner_->UseMockTheme()) | 149 if (!test_runner_->UseMockTheme()) |
| 156 return 0; | 150 return 0; |
| 157 if (!theme_engine_.get()) | 151 if (!theme_engine_.get()) |
| 158 theme_engine_.reset(new MockWebThemeEngine()); | 152 theme_engine_.reset(new MockWebThemeEngine()); |
| 159 return theme_engine_.get(); | 153 return theme_engine_.get(); |
| 160 } | 154 } |
| 161 | 155 |
| 162 AppBannerClient* TestInterfaces::GetAppBannerClient() { | |
| 163 return app_banner_client_; | |
| 164 } | |
| 165 | |
| 166 } // namespace test_runner | 156 } // namespace test_runner |
| OLD | NEW |