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

Side by Side Diff: chrome/test/automated_ui_tests/automated_ui_test_base.cc

Issue 196096: First part of automated_ui_tests improvements.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: disable on lin/mac Created 11 years, 3 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/app/chrome_dll_resource.h" 5 #include "chrome/app/chrome_dll_resource.h"
6 #include "chrome/browser/view_ids.h" 6 #include "chrome/browser/view_ids.h"
7 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" 7 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
8 #include "chrome/test/automation/browser_proxy.h" 8 #include "chrome/test/automation/browser_proxy.h"
9 #include "chrome/test/automation/tab_proxy.h" 9 #include "chrome/test/automation/tab_proxy.h"
10 #include "chrome/test/automation/window_proxy.h" 10 #include "chrome/test/automation/window_proxy.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 if (!browser->WaitForTabToBecomeActive(new_tab_index, action_timeout_ms())) { 235 if (!browser->WaitForTabToBecomeActive(new_tab_index, action_timeout_ms())) {
236 LogWarningMessage("failed_to_reindex_tab"); 236 LogWarningMessage("failed_to_reindex_tab");
237 return false; 237 return false;
238 } 238 }
239 239
240 return true; 240 return true;
241 } 241 }
242 #endif 242 #endif
243 243
244 bool AutomatedUITestBase::FindInPage() {
245 if (!RunCommandAsync(IDC_FIND))
246 return false;
247
248 return WaitForFindWindowVisibilityChange(active_browser(), true);
249 }
250
244 bool AutomatedUITestBase::ForwardButton() { 251 bool AutomatedUITestBase::ForwardButton() {
245 return RunCommand(IDC_FORWARD); 252 return RunCommand(IDC_FORWARD);
246 } 253 }
247 254
248 bool AutomatedUITestBase::GoOffTheRecord() { 255 bool AutomatedUITestBase::GoOffTheRecord() {
249 return RunCommand(IDC_NEW_INCOGNITO_WINDOW); 256 return RunCommand(IDC_NEW_INCOGNITO_WINDOW);
250 } 257 }
251 258
259 bool AutomatedUITestBase::Home() {
260 return RunCommand(IDC_HOME);
261 }
262
252 bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow( 263 bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow(
253 scoped_refptr<BrowserProxy>* previous_browser) { 264 scoped_refptr<BrowserProxy>* previous_browser) {
254 if (!automation()->OpenNewBrowserWindow(true /* SW_SHOWNORMAL */)) { 265 if (!automation()->OpenNewBrowserWindow(true /* SW_SHOWNORMAL */)) {
255 LogWarningMessage("failed_to_open_new_browser_window"); 266 LogWarningMessage("failed_to_open_new_browser_window");
256 return false; 267 return false;
257 } 268 }
258 int num_browser_windows; 269 int num_browser_windows;
259 if (!automation()->GetBrowserWindowCount(&num_browser_windows)) { 270 if (!automation()->GetBrowserWindowCount(&num_browser_windows)) {
260 LogErrorMessage("failed_to_get_browser_window_count"); 271 LogErrorMessage("failed_to_get_browser_window_count");
261 return false; 272 return false;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 321 }
311 322
312 bool AutomatedUITestBase::ReloadPage() { 323 bool AutomatedUITestBase::ReloadPage() {
313 return RunCommand(IDC_RELOAD); 324 return RunCommand(IDC_RELOAD);
314 } 325 }
315 326
316 bool AutomatedUITestBase::RestoreTab() { 327 bool AutomatedUITestBase::RestoreTab() {
317 return RunCommand(IDC_RESTORE_TAB); 328 return RunCommand(IDC_RESTORE_TAB);
318 } 329 }
319 330
331 bool AutomatedUITestBase::SelectNextTab() {
332 return RunCommand(IDC_SELECT_NEXT_TAB);
333 }
334
335 bool AutomatedUITestBase::SelectPreviousTab() {
336 return RunCommand(IDC_SELECT_PREVIOUS_TAB);
337 }
338
339 bool AutomatedUITestBase::ShowBookmarkBar() {
340 bool is_visible;
341 bool is_animating;
342 if (!active_browser()->GetBookmarkBarVisibility(&is_visible,
343 &is_animating)) {
344 return false;
345 }
346
347 if (is_visible) {
348 // If the bar is visible, then issuing the command again will toggle it.
349 return true;
350 }
351
352 if (!RunCommandAsync(IDC_SHOW_BOOKMARK_BAR))
353 return false;
354
355 return WaitForBookmarkBarVisibilityChange(active_browser(), true);
356 }
357
358 bool AutomatedUITestBase::ShowDownloads() {
359 return RunCommand(IDC_SHOW_DOWNLOADS);
360 }
361
362 bool AutomatedUITestBase::ShowHistory() {
363 return RunCommand(IDC_SHOW_HISTORY);
364 }
365
320 bool AutomatedUITestBase::RunCommandAsync(int browser_command) { 366 bool AutomatedUITestBase::RunCommandAsync(int browser_command) {
321 BrowserProxy* browser = active_browser(); 367 BrowserProxy* browser = active_browser();
322 if (NULL == browser) { 368 if (NULL == browser) {
323 LogErrorMessage("browser_window_not_found"); 369 LogErrorMessage("browser_window_not_found");
324 return false; 370 return false;
325 } 371 }
326 372
327 if (!browser->RunCommandAsync(browser_command)) { 373 if (!browser->RunCommandAsync(browser_command)) {
328 LogWarningMessage("failure_running_browser_command"); 374 LogWarningMessage("failure_running_browser_command");
329 return false; 375 return false;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 BrowserProxy* browser) { 410 BrowserProxy* browser) {
365 bool did_timeout; 411 bool did_timeout;
366 if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(), 412 if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(),
367 &did_timeout)) { 413 &did_timeout)) {
368 LogWarningMessage("failed_to_bring_window_to_front"); 414 LogWarningMessage("failed_to_bring_window_to_front");
369 return NULL; 415 return NULL;
370 } 416 }
371 417
372 return browser->GetWindow(); 418 return browser->GetWindow();
373 } 419 }
OLDNEW
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.h ('k') | chrome/test/automated_ui_tests/automated_ui_test_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698