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

Side by Side Diff: chrome/test/automated_ui_tests/automated_ui_tests.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
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_tests.h ('k') | chrome/test/ui/ui_test.cc » ('j') | no next file with comments »
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 <fstream> 5 #include <fstream>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 did_complete_action = ViewSource(); 418 did_complete_action = ViewSource();
419 } else if (LowerCaseEqualsASCII(action, "zoomplus")) { 419 } else if (LowerCaseEqualsASCII(action, "zoomplus")) {
420 did_complete_action = ZoomPlus(); 420 did_complete_action = ZoomPlus();
421 } else if (LowerCaseEqualsASCII(action, "zoomminus")) { 421 } else if (LowerCaseEqualsASCII(action, "zoomminus")) {
422 did_complete_action = ZoomMinus(); 422 did_complete_action = ZoomMinus();
423 } else { 423 } else {
424 NOTREACHED() << "Unknown command passed into DoAction: " 424 NOTREACHED() << "Unknown command passed into DoAction: "
425 << action.c_str(); 425 << action.c_str();
426 } 426 }
427 427
428 EXPECT_TRUE(did_complete_action) << action;
429
428 if (!did_complete_action) 430 if (!did_complete_action)
429 xml_writer_.AddAttribute("failed_to_complete", "yes"); 431 xml_writer_.AddAttribute("failed_to_complete", "yes");
430 xml_writer_.EndElement(); 432 xml_writer_.EndElement();
431 433
432 if (post_action_delay_) 434 if (post_action_delay_)
433 PlatformThread::Sleep(1000 * post_action_delay_); 435 PlatformThread::Sleep(1000 * post_action_delay_);
434 436
435 return did_complete_action; 437 return did_complete_action;
436 } 438 }
437 439
(...skipping 10 matching lines...) Expand all
448 // The vector will contain mostly IDC values for encoding commands plus a few 450 // The vector will contain mostly IDC values for encoding commands plus a few
449 // menu separators (0 values). If we hit a separator we just retry. 451 // menu separators (0 values). If we hit a separator we just retry.
450 int index = base::RandInt(0, len); 452 int index = base::RandInt(0, len);
451 while ((*encodings)[index].encoding_id == 0) { 453 while ((*encodings)[index].encoding_id == 0) {
452 index = base::RandInt(0, len); 454 index = base::RandInt(0, len);
453 } 455 }
454 456
455 return RunCommandAsync((*encodings)[index].encoding_id); 457 return RunCommandAsync((*encodings)[index].encoding_id);
456 } 458 }
457 459
458 bool AutomatedUITest::FindInPage() {
459 return RunCommandAsync(IDC_FIND);
460 }
461
462 bool AutomatedUITest::Home() {
463 return RunCommandAsync(IDC_HOME);
464 }
465
466 bool AutomatedUITest::JavaScriptConsole() { 460 bool AutomatedUITest::JavaScriptConsole() {
467 return RunCommandAsync(IDC_DEV_TOOLS); 461 return RunCommandAsync(IDC_DEV_TOOLS);
468 } 462 }
469 463
470 bool AutomatedUITest::OpenAboutDialog() { 464 bool AutomatedUITest::OpenAboutDialog() {
471 return RunCommandAsync(IDC_ABOUT); 465 return RunCommandAsync(IDC_ABOUT);
472 } 466 }
473 467
474 bool AutomatedUITest::OpenClearBrowsingDataDialog() { 468 bool AutomatedUITest::OpenClearBrowsingDataDialog() {
475 return RunCommandAsync(IDC_CLEAR_BROWSING_DATA); 469 return RunCommandAsync(IDC_CLEAR_BROWSING_DATA);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 514 }
521 515
522 bool AutomatedUITest::PressTabKey() { 516 bool AutomatedUITest::PressTabKey() {
523 return SimulateKeyPressInActiveWindow(base::VKEY_TAB, 0); 517 return SimulateKeyPressInActiveWindow(base::VKEY_TAB, 0);
524 } 518 }
525 519
526 bool AutomatedUITest::PressUpArrow() { 520 bool AutomatedUITest::PressUpArrow() {
527 return SimulateKeyPressInActiveWindow(base::VKEY_UP, 0); 521 return SimulateKeyPressInActiveWindow(base::VKEY_UP, 0);
528 } 522 }
529 523
530 bool AutomatedUITest::SelectNextTab() {
531 return RunCommandAsync(IDC_SELECT_NEXT_TAB);
532 }
533
534 bool AutomatedUITest::SelectPreviousTab() {
535 return RunCommandAsync(IDC_SELECT_PREVIOUS_TAB);
536 }
537
538 bool AutomatedUITest::ShowBookmarkBar() {
539 return RunCommandAsync(IDC_SHOW_BOOKMARK_BAR);
540 }
541
542 bool AutomatedUITest::ShowDownloads() {
543 return RunCommandAsync(IDC_SHOW_DOWNLOADS);
544 }
545
546 bool AutomatedUITest::ShowHistory() {
547 return RunCommandAsync(IDC_SHOW_HISTORY);
548 }
549
550 bool AutomatedUITest::StarPage() { 524 bool AutomatedUITest::StarPage() {
551 return RunCommandAsync(IDC_STAR); 525 return RunCommandAsync(IDC_STAR);
552 } 526 }
553 527
554 bool AutomatedUITest::ViewSource() { 528 bool AutomatedUITest::ViewSource() {
555 return RunCommandAsync(IDC_VIEW_SOURCE); 529 return RunCommandAsync(IDC_VIEW_SOURCE);
556 } 530 }
557 531
558 bool AutomatedUITest::ZoomMinus() { 532 bool AutomatedUITest::ZoomMinus() {
559 return RunCommandAsync(IDC_ZOOM_MINUS); 533 return RunCommandAsync(IDC_ZOOM_MINUS);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 } 753 }
780 } 754 }
781 755
782 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { 756 TEST_F(AutomatedUITest, TheOneAndOnlyTest) {
783 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 757 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
784 if (parsed_command_line.HasSwitch(kReproSwitch)) 758 if (parsed_command_line.HasSwitch(kReproSwitch))
785 RunReproduction(); 759 RunReproduction();
786 else 760 else
787 RunAutomatedUITest(); 761 RunAutomatedUITest();
788 } 762 }
OLDNEW
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_tests.h ('k') | chrome/test/ui/ui_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698