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