| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (spec.find("/viewsource/") != std::string::npos) { | 108 if (spec.find("/viewsource/") != std::string::npos) { |
| 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 test_runner_->set_is_web_platform_tests_mode(); | 115 test_runner_->set_is_web_platform_tests_mode(); |
| 118 } | 116 } |
| 119 | 117 |
| 120 void TestInterfaces::SetAppBannerClient(AppBannerClient* app_banner_client) { | |
| 121 app_banner_client_ = app_banner_client; | |
| 122 } | |
| 123 | |
| 124 void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) { | 118 void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) { |
| 125 window_list_.push_back(proxy); | 119 window_list_.push_back(proxy); |
| 126 } | 120 } |
| 127 | 121 |
| 128 void TestInterfaces::WindowClosed(WebViewTestProxyBase* proxy) { | 122 void TestInterfaces::WindowClosed(WebViewTestProxyBase* proxy) { |
| 129 std::vector<WebViewTestProxyBase*>::iterator pos = | 123 std::vector<WebViewTestProxyBase*>::iterator pos = |
| 130 std::find(window_list_.begin(), window_list_.end(), proxy); | 124 std::find(window_list_.begin(), window_list_.end(), proxy); |
| 131 if (pos == window_list_.end()) { | 125 if (pos == window_list_.end()) { |
| 132 NOTREACHED(); | 126 NOTREACHED(); |
| 133 return; | 127 return; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 151 } | 145 } |
| 152 | 146 |
| 153 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { | 147 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { |
| 154 if (!test_runner_->UseMockTheme()) | 148 if (!test_runner_->UseMockTheme()) |
| 155 return 0; | 149 return 0; |
| 156 if (!theme_engine_.get()) | 150 if (!theme_engine_.get()) |
| 157 theme_engine_.reset(new MockWebThemeEngine()); | 151 theme_engine_.reset(new MockWebThemeEngine()); |
| 158 return theme_engine_.get(); | 152 return theme_engine_.get(); |
| 159 } | 153 } |
| 160 | 154 |
| 161 AppBannerClient* TestInterfaces::GetAppBannerClient() { | |
| 162 return app_banner_client_; | |
| 163 } | |
| 164 | |
| 165 } // namespace test_runner | 155 } // namespace test_runner |
| OLD | NEW |