| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_plugin.h" | 5 #include "components/test_runner/test_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 for (int i = 0; i < length; ++i) { | 72 for (int i = 0; i < length; ++i) { |
| 73 delegate->PrintMessage(base::StringPrintf("* %.2f, %.2f: %s\n", | 73 delegate->PrintMessage(base::StringPrintf("* %.2f, %.2f: %s\n", |
| 74 points[i].position.x, | 74 points[i].position.x, |
| 75 points[i].position.y, | 75 points[i].position.y, |
| 76 PointState(points[i].state))); | 76 PointState(points[i].state))); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void PrintEventDetails(WebTestDelegate* delegate, | 80 void PrintEventDetails(WebTestDelegate* delegate, |
| 81 const blink::WebInputEvent& event) { | 81 const blink::WebInputEvent& event) { |
| 82 if (blink::WebInputEvent::isTouchEventType(event.type)) { | 82 if (blink::WebInputEvent::isTouchEventType(event.type())) { |
| 83 const blink::WebTouchEvent& touch = | 83 const blink::WebTouchEvent& touch = |
| 84 static_cast<const blink::WebTouchEvent&>(event); | 84 static_cast<const blink::WebTouchEvent&>(event); |
| 85 PrintTouchList(delegate, touch.touches, touch.touchesLength); | 85 PrintTouchList(delegate, touch.touches, touch.touchesLength); |
| 86 } else if (blink::WebInputEvent::isMouseEventType(event.type) || | 86 } else if (blink::WebInputEvent::isMouseEventType(event.type()) || |
| 87 event.type == blink::WebInputEvent::MouseWheel) { | 87 event.type() == blink::WebInputEvent::MouseWheel) { |
| 88 const blink::WebMouseEvent& mouse = | 88 const blink::WebMouseEvent& mouse = |
| 89 static_cast<const blink::WebMouseEvent&>(event); | 89 static_cast<const blink::WebMouseEvent&>(event); |
| 90 delegate->PrintMessage(base::StringPrintf("* %d, %d\n", mouse.x, mouse.y)); | 90 delegate->PrintMessage(base::StringPrintf("* %d, %d\n", mouse.x, mouse.y)); |
| 91 } else if (blink::WebInputEvent::isGestureEventType(event.type)) { | 91 } else if (blink::WebInputEvent::isGestureEventType(event.type())) { |
| 92 const blink::WebGestureEvent& gesture = | 92 const blink::WebGestureEvent& gesture = |
| 93 static_cast<const blink::WebGestureEvent&>(event); | 93 static_cast<const blink::WebGestureEvent&>(event); |
| 94 delegate->PrintMessage( | 94 delegate->PrintMessage( |
| 95 base::StringPrintf("* %d, %d\n", gesture.x, gesture.y)); | 95 base::StringPrintf("* %d, %d\n", gesture.x, gesture.y)); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 blink::WebPluginContainer::TouchEventRequestType ParseTouchEventRequestType( | 99 blink::WebPluginContainer::TouchEventRequestType ParseTouchEventRequestType( |
| 100 const blink::WebString& string) { | 100 const blink::WebString& string) { |
| 101 if (string == blink::WebString::fromUTF8("raw")) | 101 if (string == blink::WebString::fromUTF8("raw")) |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 gl_->DeleteShader(vertex_shader); | 531 gl_->DeleteShader(vertex_shader); |
| 532 if (fragment_shader) | 532 if (fragment_shader) |
| 533 gl_->DeleteShader(fragment_shader); | 533 gl_->DeleteShader(fragment_shader); |
| 534 | 534 |
| 535 return program; | 535 return program; |
| 536 } | 536 } |
| 537 | 537 |
| 538 blink::WebInputEventResult TestPlugin::handleInputEvent( | 538 blink::WebInputEventResult TestPlugin::handleInputEvent( |
| 539 const blink::WebInputEvent& event, | 539 const blink::WebInputEvent& event, |
| 540 blink::WebCursorInfo& info) { | 540 blink::WebCursorInfo& info) { |
| 541 const char* event_name = blink::WebInputEvent::GetName(event.type); | 541 const char* event_name = blink::WebInputEvent::GetName(event.type()); |
| 542 if (!strcmp(event_name, "") || !strcmp(event_name, "Undefined")) | 542 if (!strcmp(event_name, "") || !strcmp(event_name, "Undefined")) |
| 543 event_name = "unknown"; | 543 event_name = "unknown"; |
| 544 delegate_->PrintMessage(std::string("Plugin received event: ") + event_name + | 544 delegate_->PrintMessage(std::string("Plugin received event: ") + event_name + |
| 545 "\n"); | 545 "\n"); |
| 546 if (print_event_details_) | 546 if (print_event_details_) |
| 547 PrintEventDetails(delegate_, event); | 547 PrintEventDetails(delegate_, event); |
| 548 if (print_user_gesture_status_) | 548 if (print_user_gesture_status_) |
| 549 delegate_->PrintMessage( | 549 delegate_->PrintMessage( |
| 550 std::string("* ") + | 550 std::string("* ") + |
| 551 (blink::WebUserGestureIndicator::isProcessingUserGesture() ? "" | 551 (blink::WebUserGestureIndicator::isProcessingUserGesture() ? "" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 return kPluginPersistsMimeType; | 612 return kPluginPersistsMimeType; |
| 613 } | 613 } |
| 614 | 614 |
| 615 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 615 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
| 616 return mime_type == TestPlugin::MimeType() || | 616 return mime_type == TestPlugin::MimeType() || |
| 617 mime_type == PluginPersistsMimeType() || | 617 mime_type == PluginPersistsMimeType() || |
| 618 mime_type == CanCreateWithoutRendererMimeType(); | 618 mime_type == CanCreateWithoutRendererMimeType(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 } // namespace test_runner | 621 } // namespace test_runner |
| OLD | NEW |