OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/web_frame_test_client.h" | 5 #include "components/test_runner/web_frame_test_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 blink::WebColorChooser* WebFrameTestClient::createColorChooser( | 182 blink::WebColorChooser* WebFrameTestClient::createColorChooser( |
183 blink::WebColorChooserClient* client, | 183 blink::WebColorChooserClient* client, |
184 const blink::WebColor& color, | 184 const blink::WebColor& color, |
185 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { | 185 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { |
186 // This instance is deleted by WebCore::ColorInputType | 186 // This instance is deleted by WebCore::ColorInputType |
187 return new MockColorChooser(client, delegate_, test_runner()); | 187 return new MockColorChooser(client, delegate_, test_runner()); |
188 } | 188 } |
189 | 189 |
190 void WebFrameTestClient::runModalAlertDialog(const blink::WebString& message) { | 190 void WebFrameTestClient::runModalAlertDialog(const blink::WebString& message) { |
| 191 if (!test_runner()->ShouldDumpJavaScriptDialogs()) |
| 192 return; |
191 delegate_->PrintMessage(std::string("ALERT: ") + message.utf8().data() + | 193 delegate_->PrintMessage(std::string("ALERT: ") + message.utf8().data() + |
192 "\n"); | 194 "\n"); |
193 } | 195 } |
194 | 196 |
195 bool WebFrameTestClient::runModalConfirmDialog( | 197 bool WebFrameTestClient::runModalConfirmDialog( |
196 const blink::WebString& message) { | 198 const blink::WebString& message) { |
| 199 if (!test_runner()->ShouldDumpJavaScriptDialogs()) |
| 200 return true; |
197 delegate_->PrintMessage(std::string("CONFIRM: ") + message.utf8().data() + | 201 delegate_->PrintMessage(std::string("CONFIRM: ") + message.utf8().data() + |
198 "\n"); | 202 "\n"); |
199 return true; | 203 return true; |
200 } | 204 } |
201 | 205 |
202 bool WebFrameTestClient::runModalPromptDialog( | 206 bool WebFrameTestClient::runModalPromptDialog( |
203 const blink::WebString& message, | 207 const blink::WebString& message, |
204 const blink::WebString& default_value, | 208 const blink::WebString& default_value, |
205 blink::WebString* actual_value) { | 209 blink::WebString* actual_value) { |
| 210 if (!test_runner()->ShouldDumpJavaScriptDialogs()) |
| 211 return true; |
206 delegate_->PrintMessage(std::string("PROMPT: ") + message.utf8().data() + | 212 delegate_->PrintMessage(std::string("PROMPT: ") + message.utf8().data() + |
207 ", default text: " + default_value.utf8().data() + | 213 ", default text: " + default_value.utf8().data() + |
208 "\n"); | 214 "\n"); |
209 return true; | 215 return true; |
210 } | 216 } |
211 | 217 |
212 bool WebFrameTestClient::runModalBeforeUnloadDialog(bool is_reload) { | 218 bool WebFrameTestClient::runModalBeforeUnloadDialog(bool is_reload) { |
213 delegate_->PrintMessage(std::string("CONFIRM NAVIGATION\n")); | 219 if (test_runner()->ShouldDumpJavaScriptDialogs()) |
| 220 delegate_->PrintMessage(std::string("CONFIRM NAVIGATION\n")); |
214 return !test_runner()->shouldStayOnPageAfterHandlingBeforeUnload(); | 221 return !test_runner()->shouldStayOnPageAfterHandlingBeforeUnload(); |
215 } | 222 } |
216 | 223 |
217 blink::WebScreenOrientationClient* | 224 blink::WebScreenOrientationClient* |
218 WebFrameTestClient::webScreenOrientationClient() { | 225 WebFrameTestClient::webScreenOrientationClient() { |
219 return test_runner()->getMockScreenOrientationClient(); | 226 return test_runner()->getMockScreenOrientationClient(); |
220 } | 227 } |
221 | 228 |
222 void WebFrameTestClient::postAccessibilityEvent(const blink::WebAXObject& obj, | 229 void WebFrameTestClient::postAccessibilityEvent(const blink::WebAXObject& obj, |
223 blink::WebAXEvent event) { | 230 blink::WebAXEvent event) { |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 blink::WebEffectiveConnectionType | 705 blink::WebEffectiveConnectionType |
699 WebFrameTestClient::getEffectiveConnectionType() { | 706 WebFrameTestClient::getEffectiveConnectionType() { |
700 return test_runner()->effective_connection_type(); | 707 return test_runner()->effective_connection_type(); |
701 } | 708 } |
702 | 709 |
703 TestRunner* WebFrameTestClient::test_runner() { | 710 TestRunner* WebFrameTestClient::test_runner() { |
704 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 711 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
705 } | 712 } |
706 | 713 |
707 } // namespace test_runner | 714 } // namespace test_runner |
OLD | NEW |