diff options
Diffstat (limited to 'chrome/test/reliability/automated_ui_test_base.cc')
-rw-r--r-- | chrome/test/reliability/automated_ui_test_base.cc | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/chrome/test/reliability/automated_ui_test_base.cc b/chrome/test/reliability/automated_ui_test_base.cc index 617b386..426f0ae 100644 --- a/chrome/test/reliability/automated_ui_test_base.cc +++ b/chrome/test/reliability/automated_ui_test_base.cc @@ -87,146 +87,6 @@ bool AutomatedUITestBase::DuplicateTab() { return RunCommand(IDC_DUPLICATE_TAB); } -bool AutomatedUITestBase::DragTabOut() { - BrowserProxy* browser = active_browser(); - if (browser == NULL) { - LogErrorMessage("browser_window_not_found"); - return false; - } - - scoped_refptr<WindowProxy> window( - GetAndActivateWindowForBrowser(browser)); - if (window.get() == NULL) { - LogErrorMessage("active_window_not_found"); - return false; - } - - int tab_count; - if (!browser->GetTabCount(&tab_count)) { - LogErrorMessage("get_tab_count_failed"); - return false; - } - - if (tab_count < 2) { - LogWarningMessage("not_enough_tabs_to_drag_out"); - return false; - } - - int tab_index; - if (!browser->GetActiveTabIndex(&tab_index)) { - LogWarningMessage("no_active_tab"); - return false; - } - - if (tab_index < 0) { - LogInfoMessage("invalid_active_tab_index"); - return false; - } - - gfx::Rect dragged_tab_bounds; - if (!window->GetViewBounds(VIEW_ID_TAB_0 + tab_index, - &dragged_tab_bounds, false)) { - LogWarningMessage("no_tab_view_found"); - return false; - } - - gfx::Rect urlbar_bounds; - if (!window->GetViewBounds(VIEW_ID_LOCATION_BAR, - &urlbar_bounds, false)) { - LogWarningMessage("no_location_bar_found"); - return false; - } - - // Click on the center of the tab, and drag it downwards. - gfx::Point start; - gfx::Point end; - start.set_x(dragged_tab_bounds.x() + dragged_tab_bounds.width() / 2); - start.set_y(dragged_tab_bounds.y() + dragged_tab_bounds.height() / 2); - end.set_x(start.x()); - end.set_y(start.y() + 3 * urlbar_bounds.height()); - - if (!browser->SimulateDrag(start, end, ui::EF_LEFT_MOUSE_BUTTON, false)) { - LogWarningMessage("failed_to_simulate_drag"); - return false; - } - - return true; -} - -bool AutomatedUITestBase::DragActiveTab(bool drag_right) { - BrowserProxy* browser = active_browser(); - if (browser == NULL) { - LogErrorMessage("browser_window_not_found"); - return false; - } - - scoped_refptr<WindowProxy> window( - GetAndActivateWindowForBrowser(browser)); - if (window.get() == NULL) { - LogErrorMessage("active_window_not_found"); - return false; - } - - int tab_count; - if (!browser->GetTabCount(&tab_count)) { - LogErrorMessage("get_tab_count_failed"); - return false; - } - - if (tab_count < 2) { - LogWarningMessage("not_enough_tabs_to_drag_around"); - return false; - } - - int tab_index; - if (!browser->GetActiveTabIndex(&tab_index)) { - LogWarningMessage("no_active_tab"); - return false; - } - - gfx::Rect dragged_tab_bounds; - if (!window->GetViewBounds(VIEW_ID_TAB_0 + tab_index, - &dragged_tab_bounds, false)) { - LogWarningMessage("no_tab_view_found"); - return false; - } - - // Click on the center of the tab, and drag it to the left or the right. - gfx::Point dragged_tab_point = dragged_tab_bounds.CenterPoint(); - gfx::Point destination_point = dragged_tab_point; - - int new_tab_index; - if (drag_right) { - if (tab_index >= (tab_count - 1)) { - LogInfoMessage("cant_drag_to_right"); - return false; - } - new_tab_index = tab_index + 1; - destination_point.Offset(2 * dragged_tab_bounds.width() / 3, 0); - } else { - if (tab_index <= 0) { - LogInfoMessage("cant_drag_to_left"); - return false; - } - new_tab_index = tab_index - 1; - destination_point.Offset(-2 * dragged_tab_bounds.width() / 3, 0); - } - - if (!browser->SimulateDrag(dragged_tab_point, destination_point, - ui::EF_LEFT_MOUSE_BUTTON, false)) { - LogWarningMessage("failed_to_simulate_drag"); - return false; - } - - if (!browser->WaitForTabToBecomeActive(new_tab_index, - TestTimeouts::action_timeout())) { - LogWarningMessage("failed_to_reindex_tab"); - return false; - } - - return true; -} - bool AutomatedUITestBase::FindInPage() { if (!RunCommandAsync(IDC_FIND)) return false; |