| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 (frame->isResourceLoadInProgress() || frame->isLoading())) | 193 (frame->isResourceLoadInProgress() || frame->isLoading())) |
| 194 return; | 194 return; |
| 195 test_runner->setTopLoadingFrame(frame, true); | 195 test_runner->setTopLoadingFrame(frame, true); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace | 198 } // namespace |
| 199 | 199 |
| 200 WebFrameTestClient::WebFrameTestClient( | 200 WebFrameTestClient::WebFrameTestClient( |
| 201 TestRunner* test_runner, | 201 TestRunner* test_runner, |
| 202 WebTestDelegate* delegate, | 202 WebTestDelegate* delegate, |
| 203 AccessibilityController* accessibility_controller, | |
| 204 WebTestProxyBase* web_test_proxy_base) | 203 WebTestProxyBase* web_test_proxy_base) |
| 205 : test_runner_(test_runner), | 204 : test_runner_(test_runner), |
| 206 delegate_(delegate), | 205 delegate_(delegate), |
| 207 accessibility_controller_(accessibility_controller), | |
| 208 web_test_proxy_base_(web_test_proxy_base) { | 206 web_test_proxy_base_(web_test_proxy_base) { |
| 209 DCHECK(test_runner); | 207 DCHECK(test_runner); |
| 210 DCHECK(delegate_); | 208 DCHECK(delegate_); |
| 211 DCHECK(accessibility_controller_); | |
| 212 DCHECK(web_test_proxy_base_); | 209 DCHECK(web_test_proxy_base_); |
| 213 } | 210 } |
| 214 | 211 |
| 215 WebFrameTestClient::~WebFrameTestClient() {} | 212 WebFrameTestClient::~WebFrameTestClient() {} |
| 216 | 213 |
| 217 blink::WebColorChooser* WebFrameTestClient::createColorChooser( | 214 blink::WebColorChooser* WebFrameTestClient::createColorChooser( |
| 218 blink::WebColorChooserClient* client, | 215 blink::WebColorChooserClient* client, |
| 219 const blink::WebColor& color, | 216 const blink::WebColor& color, |
| 220 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { | 217 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { |
| 221 // This instance is deleted by WebCore::ColorInputType | 218 // This instance is deleted by WebCore::ColorInputType |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 event_name = "TextRemoved"; | 358 event_name = "TextRemoved"; |
| 362 break; | 359 break; |
| 363 case blink::WebAXEventValueChanged: | 360 case blink::WebAXEventValueChanged: |
| 364 event_name = "ValueChanged"; | 361 event_name = "ValueChanged"; |
| 365 break; | 362 break; |
| 366 default: | 363 default: |
| 367 event_name = "Unknown"; | 364 event_name = "Unknown"; |
| 368 break; | 365 break; |
| 369 } | 366 } |
| 370 | 367 |
| 371 accessibility_controller_->NotificationReceived(obj, event_name); | 368 AccessibilityController* accessibility_controller = |
| 372 if (accessibility_controller_->ShouldLogAccessibilityEvents()) { | 369 web_test_proxy_base_->accessibility_controller(); |
| 370 accessibility_controller->NotificationReceived(obj, event_name); |
| 371 if (accessibility_controller->ShouldLogAccessibilityEvents()) { |
| 373 std::string message("AccessibilityNotification - "); | 372 std::string message("AccessibilityNotification - "); |
| 374 message += event_name; | 373 message += event_name; |
| 375 | 374 |
| 376 blink::WebNode node = obj.node(); | 375 blink::WebNode node = obj.node(); |
| 377 if (!node.isNull() && node.isElementNode()) { | 376 if (!node.isNull() && node.isElementNode()) { |
| 378 blink::WebElement element = node.to<blink::WebElement>(); | 377 blink::WebElement element = node.to<blink::WebElement>(); |
| 379 if (element.hasAttribute("id")) { | 378 if (element.hasAttribute("id")) { |
| 380 message += " - id:"; | 379 message += " - id:"; |
| 381 message += element.getAttribute("id").utf8().data(); | 380 message += element.getAttribute("id").utf8().data(); |
| 382 } | 381 } |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 else | 768 else |
| 770 callback->onError(blink::WebSetSinkIdError::NotFound); | 769 callback->onError(blink::WebSetSinkIdError::NotFound); |
| 771 } | 770 } |
| 772 | 771 |
| 773 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { | 772 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { |
| 774 web_test_proxy_base_->test_interfaces()->BindTo(frame); | 773 web_test_proxy_base_->test_interfaces()->BindTo(frame); |
| 775 web_test_proxy_base_->BindTo(frame); | 774 web_test_proxy_base_->BindTo(frame); |
| 776 } | 775 } |
| 777 | 776 |
| 778 } // namespace test_runner | 777 } // namespace test_runner |
| OLD | NEW |