Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: chrome/browser/automation/automation_provider.cc

Issue 174201: More interactive test porting for Linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fixes Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/automation/ui_controls.h » ('j') | chrome/common/gtk_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/automation_provider.h" 5 #include "chrome/browser/automation/automation_provider.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h" 8 #include "app/message_box_flags.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/json_reader.h" 10 #include "base/json_reader.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "chrome/browser/automation/ui_controls.h" 66 #include "chrome/browser/automation/ui_controls.h"
67 #endif 67 #endif
68 68
69 #if defined(OS_WIN) 69 #if defined(OS_WIN)
70 #include "chrome/browser/views/bookmark_bar_view.h" 70 #include "chrome/browser/views/bookmark_bar_view.h"
71 #include "views/widget/root_view.h" 71 #include "views/widget/root_view.h"
72 #include "views/widget/widget_win.h" 72 #include "views/widget/widget_win.h"
73 #include "views/window/window.h" 73 #include "views/window/window.h"
74 #elif defined(OS_LINUX) 74 #elif defined(OS_LINUX)
75 #include "chrome/browser/gtk/view_id_util.h" 75 #include "chrome/browser/gtk/view_id_util.h"
76 #include "chrome/common/gtk_util.h"
76 #endif 77 #endif
77 78
78 using base::Time; 79 using base::Time;
79 80
80 #if defined(OS_WIN) 81 #if defined(OS_WIN)
81 static void MoveMouse(const POINT& point) { 82 static void MoveMouse(const POINT& point) {
82 SetCursorPos(point.x, point.y); 83 SetCursorPos(point.x, point.y);
83 84
84 // Now, make sure that GetMessagePos returns the values we just set by 85 // Now, make sure that GetMessagePos returns the values we just set by
85 // simulating a mouse move. The value returned by GetMessagePos is updated 86 // simulating a mouse move. The value returned by GetMessagePos is updated
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 786
786 private: 787 private:
787 std::string contents_; 788 std::string contents_;
788 789
789 DISALLOW_COPY_AND_ASSIGN(AutomationInterstitialPage); 790 DISALLOW_COPY_AND_ASSIGN(AutomationInterstitialPage);
790 }; 791 };
791 792
792 #if !defined(OS_MACOSX) 793 #if !defined(OS_MACOSX)
793 class ClickTask : public Task { 794 class ClickTask : public Task {
794 public: 795 public:
795 ClickTask(gfx::Point point, int flags) : point_(point), flags_(flags) {} 796 explicit ClickTask(int flags) : flags_(flags) {}
796 virtual ~ClickTask() {} 797 virtual ~ClickTask() {}
797 798
798 virtual void Run() { 799 virtual void Run() {
799 ui_controls::MouseButton button = ui_controls::LEFT; 800 ui_controls::MouseButton button = ui_controls::LEFT;
800 if ((flags_ & views::Event::EF_LEFT_BUTTON_DOWN) == 801 if ((flags_ & views::Event::EF_LEFT_BUTTON_DOWN) ==
801 views::Event::EF_LEFT_BUTTON_DOWN) { 802 views::Event::EF_LEFT_BUTTON_DOWN) {
802 button = ui_controls::LEFT; 803 button = ui_controls::LEFT;
803 } else if ((flags_ & views::Event::EF_RIGHT_BUTTON_DOWN) == 804 } else if ((flags_ & views::Event::EF_RIGHT_BUTTON_DOWN) ==
804 views::Event::EF_RIGHT_BUTTON_DOWN) { 805 views::Event::EF_RIGHT_BUTTON_DOWN) {
805 button = ui_controls::RIGHT; 806 button = ui_controls::RIGHT;
806 } else if ((flags_ & views::Event::EF_MIDDLE_BUTTON_DOWN) == 807 } else if ((flags_ & views::Event::EF_MIDDLE_BUTTON_DOWN) ==
807 views::Event::EF_MIDDLE_BUTTON_DOWN) { 808 views::Event::EF_MIDDLE_BUTTON_DOWN) {
808 button = ui_controls::MIDDLE; 809 button = ui_controls::MIDDLE;
809 } else { 810 } else {
810 NOTREACHED(); 811 NOTREACHED();
811 } 812 }
812 813
813 ui_controls::SendMouseClick(point_, button); 814 ui_controls::SendMouseClick(button);
814 } 815 }
815 816
816 private: 817 private:
817 gfx::Point point_;
818 int flags_; 818 int flags_;
819 819
820 DISALLOW_COPY_AND_ASSIGN(ClickTask); 820 DISALLOW_COPY_AND_ASSIGN(ClickTask);
821 }; 821 };
822 #endif 822 #endif
823 823
824 AutomationProvider::AutomationProvider(Profile* profile) 824 AutomationProvider::AutomationProvider(Profile* profile)
825 : redirect_query_(0), 825 : redirect_query_(0),
826 profile_(profile), 826 profile_(profile),
827 reply_message_(NULL) { 827 reply_message_(NULL) {
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 gfx::NativeWindow window = window_tracker_->GetResource(handle); 1519 gfx::NativeWindow window = window_tracker_->GetResource(handle);
1520 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), 1520 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window),
1521 static_cast<ViewID>(view_id)); 1521 static_cast<ViewID>(view_id));
1522 if (!widget) 1522 if (!widget)
1523 return; 1523 return;
1524 *success = true; 1524 *success = true;
1525 *bounds = gfx::Rect(0, 0, 1525 *bounds = gfx::Rect(0, 0,
1526 widget->allocation.width, widget->allocation.height); 1526 widget->allocation.width, widget->allocation.height);
1527 gint x, y; 1527 gint x, y;
1528 if (screen_coordinates) { 1528 if (screen_coordinates) {
1529 gdk_window_get_origin(widget->window, &x, &y); 1529 gfx::Point point = gtk_util::GetWidgetScreenPosition(widget);
1530 if (GTK_WIDGET_NO_WINDOW(widget)) { 1530 x = point.x();
1531 x += widget->allocation.x; 1531 y = point.y();
1532 y += widget->allocation.y;
1533 }
1534 } else { 1532 } else {
1535 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), 1533 gtk_widget_translate_coordinates(widget, GTK_WIDGET(window),
1536 0, 0, &x, &y); 1534 0, 0, &x, &y);
1537 } 1535 }
1538 bounds->set_origin(gfx::Point(x, y)); 1536 bounds->set_origin(gfx::Point(x, y));
1539 #else 1537 #else
1540 NOTIMPLEMENTED(); 1538 NOTIMPLEMENTED();
1541 #endif 1539 #endif
1542 } 1540 }
1543 } 1541 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 #endif // defined(OS_WIN) 1647 #endif // defined(OS_WIN)
1650 1648
1651 #if defined(OS_WIN) || defined(OS_LINUX) 1649 #if defined(OS_WIN) || defined(OS_LINUX)
1652 void AutomationProvider::WindowSimulateClick(const IPC::Message& message, 1650 void AutomationProvider::WindowSimulateClick(const IPC::Message& message,
1653 int handle, 1651 int handle,
1654 const gfx::Point& click, 1652 const gfx::Point& click,
1655 int flags) { 1653 int flags) {
1656 1654
1657 if (window_tracker_->ContainsHandle(handle)) { 1655 if (window_tracker_->ContainsHandle(handle)) {
1658 ui_controls::SendMouseMoveNotifyWhenDone(click.x(), click.y(), 1656 ui_controls::SendMouseMoveNotifyWhenDone(click.x(), click.y(),
1659 new ClickTask(click, flags)); 1657 new ClickTask(flags));
1660 } 1658 }
1661 } 1659 }
1662 #endif 1660 #endif
1663 1661
1664 #if defined(OS_WIN) 1662 #if defined(OS_WIN)
1665 void AutomationProvider::WindowSimulateDrag(int handle, 1663 void AutomationProvider::WindowSimulateDrag(int handle,
1666 std::vector<POINT> drag_path, 1664 std::vector<POINT> drag_path,
1667 int flags, 1665 int flags,
1668 bool press_escape_en_route, 1666 bool press_escape_en_route,
1669 IPC::Message* reply_message) { 1667 IPC::Message* reply_message) {
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
3134 NOTREACHED(); 3132 NOTREACHED();
3135 return NULL; 3133 return NULL;
3136 } 3134 }
3137 3135
3138 RenderViewHost* view_host = tab_contents->render_view_host(); 3136 RenderViewHost* view_host = tab_contents->render_view_host();
3139 return view_host; 3137 return view_host;
3140 } 3138 }
3141 3139
3142 return NULL; 3140 return NULL;
3143 } 3141 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/ui_controls.h » ('j') | chrome/common/gtk_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698