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 "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 if (SendErrorIfModalDialogActive(this, reply_message)) | 657 if (SendErrorIfModalDialogActive(this, reply_message)) |
658 return; | 658 return; |
659 | 659 |
660 RenderViewHost* view; | 660 RenderViewHost* view; |
661 std::string error; | 661 std::string error; |
662 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { | 662 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { |
663 AutomationJSONReply(this, reply_message).SendError(error); | 663 AutomationJSONReply(this, reply_message).SendError(error); |
664 return; | 664 return; |
665 } | 665 } |
666 | 666 |
667 WebKit::WebMouseEvent mouse_event; | 667 blink::WebMouseEvent mouse_event; |
668 if (!args->GetInteger("x", &mouse_event.x) || | 668 if (!args->GetInteger("x", &mouse_event.x) || |
669 !args->GetInteger("y", &mouse_event.y)) { | 669 !args->GetInteger("y", &mouse_event.y)) { |
670 AutomationJSONReply(this, reply_message) | 670 AutomationJSONReply(this, reply_message) |
671 .SendError("(X,Y) coordinates missing or invalid"); | 671 .SendError("(X,Y) coordinates missing or invalid"); |
672 return; | 672 return; |
673 } | 673 } |
674 | 674 |
675 int button; | 675 int button; |
676 if (!args->GetInteger("button", &button)) { | 676 if (!args->GetInteger("button", &button)) { |
677 AutomationJSONReply(this, reply_message) | 677 AutomationJSONReply(this, reply_message) |
678 .SendError("Mouse button missing or invalid"); | 678 .SendError("Mouse button missing or invalid"); |
679 return; | 679 return; |
680 } | 680 } |
681 if (button == automation::kLeftButton) { | 681 if (button == automation::kLeftButton) { |
682 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 682 mouse_event.button = blink::WebMouseEvent::ButtonLeft; |
683 } else if (button == automation::kRightButton) { | 683 } else if (button == automation::kRightButton) { |
684 mouse_event.button = WebKit::WebMouseEvent::ButtonRight; | 684 mouse_event.button = blink::WebMouseEvent::ButtonRight; |
685 } else if (button == automation::kMiddleButton) { | 685 } else if (button == automation::kMiddleButton) { |
686 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle; | 686 mouse_event.button = blink::WebMouseEvent::ButtonMiddle; |
687 } else { | 687 } else { |
688 AutomationJSONReply(this, reply_message) | 688 AutomationJSONReply(this, reply_message) |
689 .SendError("Invalid button press requested"); | 689 .SendError("Invalid button press requested"); |
690 return; | 690 return; |
691 } | 691 } |
692 | 692 |
693 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 693 mouse_event.type = blink::WebInputEvent::MouseDown; |
694 mouse_event.clickCount = 1; | 694 mouse_event.clickCount = 1; |
695 | 695 |
696 view->ForwardMouseEvent(mouse_event); | 696 view->ForwardMouseEvent(mouse_event); |
697 | 697 |
698 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 698 mouse_event.type = blink::WebInputEvent::MouseUp; |
699 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, | 699 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, |
700 1); | 700 1); |
701 view->ForwardMouseEvent(mouse_event); | 701 view->ForwardMouseEvent(mouse_event); |
702 } | 702 } |
703 | 703 |
704 void TestingAutomationProvider::WebkitMouseMove( | 704 void TestingAutomationProvider::WebkitMouseMove( |
705 DictionaryValue* args, IPC::Message* reply_message) { | 705 DictionaryValue* args, IPC::Message* reply_message) { |
706 if (SendErrorIfModalDialogActive(this, reply_message)) | 706 if (SendErrorIfModalDialogActive(this, reply_message)) |
707 return; | 707 return; |
708 | 708 |
709 RenderViewHost* view; | 709 RenderViewHost* view; |
710 std::string error; | 710 std::string error; |
711 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { | 711 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { |
712 AutomationJSONReply(this, reply_message).SendError(error); | 712 AutomationJSONReply(this, reply_message).SendError(error); |
713 return; | 713 return; |
714 } | 714 } |
715 | 715 |
716 WebKit::WebMouseEvent mouse_event; | 716 blink::WebMouseEvent mouse_event; |
717 if (!args->GetInteger("x", &mouse_event.x) || | 717 if (!args->GetInteger("x", &mouse_event.x) || |
718 !args->GetInteger("y", &mouse_event.y)) { | 718 !args->GetInteger("y", &mouse_event.y)) { |
719 AutomationJSONReply(this, reply_message) | 719 AutomationJSONReply(this, reply_message) |
720 .SendError("(X,Y) coordinates missing or invalid"); | 720 .SendError("(X,Y) coordinates missing or invalid"); |
721 return; | 721 return; |
722 } | 722 } |
723 | 723 |
724 mouse_event.type = WebKit::WebInputEvent::MouseMove; | 724 mouse_event.type = blink::WebInputEvent::MouseMove; |
725 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, | 725 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, |
726 1); | 726 1); |
727 view->ForwardMouseEvent(mouse_event); | 727 view->ForwardMouseEvent(mouse_event); |
728 } | 728 } |
729 | 729 |
730 void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args, | 730 void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args, |
731 IPC::Message* reply_message) { | 731 IPC::Message* reply_message) { |
732 if (SendErrorIfModalDialogActive(this, reply_message)) | 732 if (SendErrorIfModalDialogActive(this, reply_message)) |
733 return; | 733 return; |
734 | 734 |
735 RenderViewHost* view; | 735 RenderViewHost* view; |
736 std::string error; | 736 std::string error; |
737 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { | 737 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { |
738 AutomationJSONReply(this, reply_message).SendError(error); | 738 AutomationJSONReply(this, reply_message).SendError(error); |
739 return; | 739 return; |
740 } | 740 } |
741 | 741 |
742 WebKit::WebMouseEvent mouse_event; | 742 blink::WebMouseEvent mouse_event; |
743 int start_x, start_y, end_x, end_y; | 743 int start_x, start_y, end_x, end_y; |
744 if (!args->GetInteger("start_x", &start_x) || | 744 if (!args->GetInteger("start_x", &start_x) || |
745 !args->GetInteger("start_y", &start_y) || | 745 !args->GetInteger("start_y", &start_y) || |
746 !args->GetInteger("end_x", &end_x) || | 746 !args->GetInteger("end_x", &end_x) || |
747 !args->GetInteger("end_y", &end_y)) { | 747 !args->GetInteger("end_y", &end_y)) { |
748 AutomationJSONReply(this, reply_message) | 748 AutomationJSONReply(this, reply_message) |
749 .SendError("Invalid start/end positions"); | 749 .SendError("Invalid start/end positions"); |
750 return; | 750 return; |
751 } | 751 } |
752 | 752 |
753 mouse_event.type = WebKit::WebInputEvent::MouseMove; | 753 mouse_event.type = blink::WebInputEvent::MouseMove; |
754 // Step 1- Move the mouse to the start position. | 754 // Step 1- Move the mouse to the start position. |
755 mouse_event.x = start_x; | 755 mouse_event.x = start_x; |
756 mouse_event.y = start_y; | 756 mouse_event.y = start_y; |
757 view->ForwardMouseEvent(mouse_event); | 757 view->ForwardMouseEvent(mouse_event); |
758 | 758 |
759 // Step 2- Left click mouse down, the mouse button is fixed. | 759 // Step 2- Left click mouse down, the mouse button is fixed. |
760 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 760 mouse_event.type = blink::WebInputEvent::MouseDown; |
761 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 761 mouse_event.button = blink::WebMouseEvent::ButtonLeft; |
762 mouse_event.clickCount = 1; | 762 mouse_event.clickCount = 1; |
763 view->ForwardMouseEvent(mouse_event); | 763 view->ForwardMouseEvent(mouse_event); |
764 | 764 |
765 // Step 3 - Move the mouse to the end position. | 765 // Step 3 - Move the mouse to the end position. |
766 mouse_event.type = WebKit::WebInputEvent::MouseMove; | 766 mouse_event.type = blink::WebInputEvent::MouseMove; |
767 mouse_event.x = end_x; | 767 mouse_event.x = end_x; |
768 mouse_event.y = end_y; | 768 mouse_event.y = end_y; |
769 mouse_event.clickCount = 0; | 769 mouse_event.clickCount = 0; |
770 view->ForwardMouseEvent(mouse_event); | 770 view->ForwardMouseEvent(mouse_event); |
771 | 771 |
772 // Step 4 - Release the left mouse button. | 772 // Step 4 - Release the left mouse button. |
773 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 773 mouse_event.type = blink::WebInputEvent::MouseUp; |
774 mouse_event.clickCount = 1; | 774 mouse_event.clickCount = 1; |
775 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, | 775 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, |
776 1); | 776 1); |
777 view->ForwardMouseEvent(mouse_event); | 777 view->ForwardMouseEvent(mouse_event); |
778 } | 778 } |
779 | 779 |
780 void TestingAutomationProvider::WebkitMouseButtonDown( | 780 void TestingAutomationProvider::WebkitMouseButtonDown( |
781 DictionaryValue* args, IPC::Message* reply_message) { | 781 DictionaryValue* args, IPC::Message* reply_message) { |
782 if (SendErrorIfModalDialogActive(this, reply_message)) | 782 if (SendErrorIfModalDialogActive(this, reply_message)) |
783 return; | 783 return; |
784 | 784 |
785 RenderViewHost* view; | 785 RenderViewHost* view; |
786 std::string error; | 786 std::string error; |
787 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { | 787 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { |
788 AutomationJSONReply(this, reply_message).SendError(error); | 788 AutomationJSONReply(this, reply_message).SendError(error); |
789 return; | 789 return; |
790 } | 790 } |
791 | 791 |
792 WebKit::WebMouseEvent mouse_event; | 792 blink::WebMouseEvent mouse_event; |
793 if (!args->GetInteger("x", &mouse_event.x) || | 793 if (!args->GetInteger("x", &mouse_event.x) || |
794 !args->GetInteger("y", &mouse_event.y)) { | 794 !args->GetInteger("y", &mouse_event.y)) { |
795 AutomationJSONReply(this, reply_message) | 795 AutomationJSONReply(this, reply_message) |
796 .SendError("(X,Y) coordinates missing or invalid"); | 796 .SendError("(X,Y) coordinates missing or invalid"); |
797 return; | 797 return; |
798 } | 798 } |
799 | 799 |
800 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 800 mouse_event.type = blink::WebInputEvent::MouseDown; |
801 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 801 mouse_event.button = blink::WebMouseEvent::ButtonLeft; |
802 mouse_event.clickCount = 1; | 802 mouse_event.clickCount = 1; |
803 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, | 803 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, |
804 1); | 804 1); |
805 view->ForwardMouseEvent(mouse_event); | 805 view->ForwardMouseEvent(mouse_event); |
806 } | 806 } |
807 | 807 |
808 void TestingAutomationProvider::WebkitMouseButtonUp( | 808 void TestingAutomationProvider::WebkitMouseButtonUp( |
809 DictionaryValue* args, IPC::Message* reply_message) { | 809 DictionaryValue* args, IPC::Message* reply_message) { |
810 if (SendErrorIfModalDialogActive(this, reply_message)) | 810 if (SendErrorIfModalDialogActive(this, reply_message)) |
811 return; | 811 return; |
812 | 812 |
813 RenderViewHost* view; | 813 RenderViewHost* view; |
814 std::string error; | 814 std::string error; |
815 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { | 815 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { |
816 AutomationJSONReply(this, reply_message).SendError(error); | 816 AutomationJSONReply(this, reply_message).SendError(error); |
817 return; | 817 return; |
818 } | 818 } |
819 | 819 |
820 WebKit::WebMouseEvent mouse_event; | 820 blink::WebMouseEvent mouse_event; |
821 if (!args->GetInteger("x", &mouse_event.x) || | 821 if (!args->GetInteger("x", &mouse_event.x) || |
822 !args->GetInteger("y", &mouse_event.y)) { | 822 !args->GetInteger("y", &mouse_event.y)) { |
823 AutomationJSONReply(this, reply_message) | 823 AutomationJSONReply(this, reply_message) |
824 .SendError("(X,Y) coordinates missing or invalid"); | 824 .SendError("(X,Y) coordinates missing or invalid"); |
825 return; | 825 return; |
826 } | 826 } |
827 | 827 |
828 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 828 mouse_event.type = blink::WebInputEvent::MouseUp; |
829 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 829 mouse_event.button = blink::WebMouseEvent::ButtonLeft; |
830 mouse_event.clickCount = 1; | 830 mouse_event.clickCount = 1; |
831 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, | 831 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, |
832 1); | 832 1); |
833 view->ForwardMouseEvent(mouse_event); | 833 view->ForwardMouseEvent(mouse_event); |
834 } | 834 } |
835 | 835 |
836 void TestingAutomationProvider::WebkitMouseDoubleClick( | 836 void TestingAutomationProvider::WebkitMouseDoubleClick( |
837 DictionaryValue* args, IPC::Message* reply_message) { | 837 DictionaryValue* args, IPC::Message* reply_message) { |
838 if (SendErrorIfModalDialogActive(this, reply_message)) | 838 if (SendErrorIfModalDialogActive(this, reply_message)) |
839 return; | 839 return; |
840 | 840 |
841 RenderViewHost* view; | 841 RenderViewHost* view; |
842 std::string error; | 842 std::string error; |
843 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { | 843 if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) { |
844 AutomationJSONReply(this, reply_message).SendError(error); | 844 AutomationJSONReply(this, reply_message).SendError(error); |
845 return; | 845 return; |
846 } | 846 } |
847 | 847 |
848 WebKit::WebMouseEvent mouse_event; | 848 blink::WebMouseEvent mouse_event; |
849 if (!args->GetInteger("x", &mouse_event.x) || | 849 if (!args->GetInteger("x", &mouse_event.x) || |
850 !args->GetInteger("y", &mouse_event.y)) { | 850 !args->GetInteger("y", &mouse_event.y)) { |
851 AutomationJSONReply(this, reply_message) | 851 AutomationJSONReply(this, reply_message) |
852 .SendError("(X,Y) coordinates missing or invalid"); | 852 .SendError("(X,Y) coordinates missing or invalid"); |
853 return; | 853 return; |
854 } | 854 } |
855 | 855 |
856 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 856 mouse_event.type = blink::WebInputEvent::MouseDown; |
857 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 857 mouse_event.button = blink::WebMouseEvent::ButtonLeft; |
858 mouse_event.clickCount = 1; | 858 mouse_event.clickCount = 1; |
859 view->ForwardMouseEvent(mouse_event); | 859 view->ForwardMouseEvent(mouse_event); |
860 | 860 |
861 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 861 mouse_event.type = blink::WebInputEvent::MouseUp; |
862 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, | 862 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type, |
863 2); | 863 2); |
864 view->ForwardMouseEvent(mouse_event); | 864 view->ForwardMouseEvent(mouse_event); |
865 | 865 |
866 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 866 mouse_event.type = blink::WebInputEvent::MouseDown; |
867 mouse_event.clickCount = 2; | 867 mouse_event.clickCount = 2; |
868 view->ForwardMouseEvent(mouse_event); | 868 view->ForwardMouseEvent(mouse_event); |
869 | 869 |
870 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 870 mouse_event.type = blink::WebInputEvent::MouseUp; |
871 view->ForwardMouseEvent(mouse_event); | 871 view->ForwardMouseEvent(mouse_event); |
872 } | 872 } |
873 | 873 |
874 void TestingAutomationProvider::DragAndDropFilePaths( | 874 void TestingAutomationProvider::DragAndDropFilePaths( |
875 DictionaryValue* args, IPC::Message* reply_message) { | 875 DictionaryValue* args, IPC::Message* reply_message) { |
876 if (SendErrorIfModalDialogActive(this, reply_message)) | 876 if (SendErrorIfModalDialogActive(this, reply_message)) |
877 return; | 877 return; |
878 | 878 |
879 RenderViewHost* view; | 879 RenderViewHost* view; |
880 std::string error; | 880 std::string error; |
(...skipping 29 matching lines...) Expand all Loading... |
910 drop_data.filenames.push_back( | 910 drop_data.filenames.push_back( |
911 content::DropData::FileInfo(path, string16())); | 911 content::DropData::FileInfo(path, string16())); |
912 } | 912 } |
913 | 913 |
914 const gfx::Point client(x, y); | 914 const gfx::Point client(x, y); |
915 // We don't set any values in screen variable because DragTarget*** ignore the | 915 // We don't set any values in screen variable because DragTarget*** ignore the |
916 // screen argument. | 916 // screen argument. |
917 const gfx::Point screen; | 917 const gfx::Point screen; |
918 | 918 |
919 int operations = 0; | 919 int operations = 0; |
920 operations |= WebKit::WebDragOperationCopy; | 920 operations |= blink::WebDragOperationCopy; |
921 operations |= WebKit::WebDragOperationLink; | 921 operations |= blink::WebDragOperationLink; |
922 operations |= WebKit::WebDragOperationMove; | 922 operations |= blink::WebDragOperationMove; |
923 | 923 |
924 view->DragTargetDragEnter( | 924 view->DragTargetDragEnter( |
925 drop_data, client, screen, | 925 drop_data, client, screen, |
926 static_cast<WebKit::WebDragOperationsMask>(operations), 0); | 926 static_cast<blink::WebDragOperationsMask>(operations), 0); |
927 new DragTargetDropAckNotificationObserver(this, reply_message); | 927 new DragTargetDropAckNotificationObserver(this, reply_message); |
928 view->DragTargetDrop(client, screen, 0); | 928 view->DragTargetDrop(client, screen, 0); |
929 } | 929 } |
930 | 930 |
931 void TestingAutomationProvider::GetTabCount(int handle, int* tab_count) { | 931 void TestingAutomationProvider::GetTabCount(int handle, int* tab_count) { |
932 *tab_count = -1; // -1 is the error code | 932 *tab_count = -1; // -1 is the error code |
933 | 933 |
934 if (browser_tracker_->ContainsHandle(handle)) { | 934 if (browser_tracker_->ContainsHandle(handle)) { |
935 Browser* browser = browser_tracker_->GetResource(handle); | 935 Browser* browser = browser_tracker_->GetResource(handle); |
936 *tab_count = browser->tab_strip_model()->count(); | 936 *tab_count = browser->tab_strip_model()->count(); |
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4103 *error = "'windowsKeyCode' missing or invalid."; | 4103 *error = "'windowsKeyCode' missing or invalid."; |
4104 return false; | 4104 return false; |
4105 } | 4105 } |
4106 if (!args->GetInteger("modifiers", &modifiers)) { | 4106 if (!args->GetInteger("modifiers", &modifiers)) { |
4107 *error = "'modifiers' missing or invalid."; | 4107 *error = "'modifiers' missing or invalid."; |
4108 return false; | 4108 return false; |
4109 } | 4109 } |
4110 if (args->GetString("keyIdentifier", &key_identifier)) { | 4110 if (args->GetString("keyIdentifier", &key_identifier)) { |
4111 base::strlcpy(event->keyIdentifier, | 4111 base::strlcpy(event->keyIdentifier, |
4112 key_identifier.c_str(), | 4112 key_identifier.c_str(), |
4113 WebKit::WebKeyboardEvent::keyIdentifierLengthCap); | 4113 blink::WebKeyboardEvent::keyIdentifierLengthCap); |
4114 } else { | 4114 } else { |
4115 *error = "'keyIdentifier' missing or invalid."; | 4115 *error = "'keyIdentifier' missing or invalid."; |
4116 return false; | 4116 return false; |
4117 } | 4117 } |
4118 | 4118 |
4119 if (type == automation::kRawKeyDownType) { | 4119 if (type == automation::kRawKeyDownType) { |
4120 event->type = WebKit::WebInputEvent::RawKeyDown; | 4120 event->type = blink::WebInputEvent::RawKeyDown; |
4121 } else if (type == automation::kKeyDownType) { | 4121 } else if (type == automation::kKeyDownType) { |
4122 event->type = WebKit::WebInputEvent::KeyDown; | 4122 event->type = blink::WebInputEvent::KeyDown; |
4123 } else if (type == automation::kKeyUpType) { | 4123 } else if (type == automation::kKeyUpType) { |
4124 event->type = WebKit::WebInputEvent::KeyUp; | 4124 event->type = blink::WebInputEvent::KeyUp; |
4125 } else if (type == automation::kCharType) { | 4125 } else if (type == automation::kCharType) { |
4126 event->type = WebKit::WebInputEvent::Char; | 4126 event->type = blink::WebInputEvent::Char; |
4127 } else { | 4127 } else { |
4128 *error = "'type' refers to an unrecognized keyboard event type"; | 4128 *error = "'type' refers to an unrecognized keyboard event type"; |
4129 return false; | 4129 return false; |
4130 } | 4130 } |
4131 | 4131 |
4132 string16 unmodified_text_truncated = unmodified_text.substr( | 4132 string16 unmodified_text_truncated = unmodified_text.substr( |
4133 0, WebKit::WebKeyboardEvent::textLengthCap - 1); | 4133 0, blink::WebKeyboardEvent::textLengthCap - 1); |
4134 memcpy(event->unmodifiedText, | 4134 memcpy(event->unmodifiedText, |
4135 unmodified_text_truncated.c_str(), | 4135 unmodified_text_truncated.c_str(), |
4136 unmodified_text_truncated.length() + 1); | 4136 unmodified_text_truncated.length() + 1); |
4137 string16 text_truncated = text.substr( | 4137 string16 text_truncated = text.substr( |
4138 0, WebKit::WebKeyboardEvent::textLengthCap - 1); | 4138 0, blink::WebKeyboardEvent::textLengthCap - 1); |
4139 memcpy(event->text, text_truncated.c_str(), text_truncated.length() + 1); | 4139 memcpy(event->text, text_truncated.c_str(), text_truncated.length() + 1); |
4140 | 4140 |
4141 event->modifiers = 0; | 4141 event->modifiers = 0; |
4142 if (modifiers & automation::kShiftKeyMask) | 4142 if (modifiers & automation::kShiftKeyMask) |
4143 event->modifiers |= WebKit::WebInputEvent::ShiftKey; | 4143 event->modifiers |= blink::WebInputEvent::ShiftKey; |
4144 if (modifiers & automation::kControlKeyMask) | 4144 if (modifiers & automation::kControlKeyMask) |
4145 event->modifiers |= WebKit::WebInputEvent::ControlKey; | 4145 event->modifiers |= blink::WebInputEvent::ControlKey; |
4146 if (modifiers & automation::kAltKeyMask) | 4146 if (modifiers & automation::kAltKeyMask) |
4147 event->modifiers |= WebKit::WebInputEvent::AltKey; | 4147 event->modifiers |= blink::WebInputEvent::AltKey; |
4148 if (modifiers & automation::kMetaKeyMask) | 4148 if (modifiers & automation::kMetaKeyMask) |
4149 event->modifiers |= WebKit::WebInputEvent::MetaKey; | 4149 event->modifiers |= blink::WebInputEvent::MetaKey; |
4150 | 4150 |
4151 event->isSystemKey = is_system_key; | 4151 event->isSystemKey = is_system_key; |
4152 event->timeStampSeconds = base::Time::Now().ToDoubleT(); | 4152 event->timeStampSeconds = base::Time::Now().ToDoubleT(); |
4153 event->skip_in_browser = true; | 4153 event->skip_in_browser = true; |
4154 return true; | 4154 return true; |
4155 } | 4155 } |
4156 | 4156 |
4157 void TestingAutomationProvider::SendWebkitKeyEvent( | 4157 void TestingAutomationProvider::SendWebkitKeyEvent( |
4158 DictionaryValue* args, | 4158 DictionaryValue* args, |
4159 IPC::Message* reply_message) { | 4159 IPC::Message* reply_message) { |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 if (g_browser_process) | 5452 if (g_browser_process) |
5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 5453 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
5454 } | 5454 } |
5455 | 5455 |
5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 5456 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
5457 WebContents* tab) { | 5457 WebContents* tab) { |
5458 TabStripModel* tab_strip = browser->tab_strip_model(); | 5458 TabStripModel* tab_strip = browser->tab_strip_model(); |
5459 if (tab_strip->GetActiveWebContents() != tab) | 5459 if (tab_strip->GetActiveWebContents() != tab) |
5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 5460 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
5461 } | 5461 } |
OLD | NEW |