OLD | NEW |
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 Loading... |
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 | |
430 if (!did_complete_action) | 428 if (!did_complete_action) |
431 xml_writer_.AddAttribute("failed_to_complete", "yes"); | 429 xml_writer_.AddAttribute("failed_to_complete", "yes"); |
432 xml_writer_.EndElement(); | 430 xml_writer_.EndElement(); |
433 | 431 |
434 if (post_action_delay_) | 432 if (post_action_delay_) |
435 PlatformThread::Sleep(1000 * post_action_delay_); | 433 PlatformThread::Sleep(1000 * post_action_delay_); |
436 | 434 |
437 return did_complete_action; | 435 return did_complete_action; |
438 } | 436 } |
439 | 437 |
(...skipping 10 matching lines...) Expand all Loading... |
450 // The vector will contain mostly IDC values for encoding commands plus a few | 448 // The vector will contain mostly IDC values for encoding commands plus a few |
451 // menu separators (0 values). If we hit a separator we just retry. | 449 // menu separators (0 values). If we hit a separator we just retry. |
452 int index = base::RandInt(0, len); | 450 int index = base::RandInt(0, len); |
453 while ((*encodings)[index].encoding_id == 0) { | 451 while ((*encodings)[index].encoding_id == 0) { |
454 index = base::RandInt(0, len); | 452 index = base::RandInt(0, len); |
455 } | 453 } |
456 | 454 |
457 return RunCommandAsync((*encodings)[index].encoding_id); | 455 return RunCommandAsync((*encodings)[index].encoding_id); |
458 } | 456 } |
459 | 457 |
| 458 bool AutomatedUITest::FindInPage() { |
| 459 return RunCommandAsync(IDC_FIND); |
| 460 } |
| 461 |
| 462 bool AutomatedUITest::Home() { |
| 463 return RunCommandAsync(IDC_HOME); |
| 464 } |
| 465 |
460 bool AutomatedUITest::JavaScriptConsole() { | 466 bool AutomatedUITest::JavaScriptConsole() { |
461 return RunCommandAsync(IDC_DEV_TOOLS); | 467 return RunCommandAsync(IDC_DEV_TOOLS); |
462 } | 468 } |
463 | 469 |
464 bool AutomatedUITest::OpenAboutDialog() { | 470 bool AutomatedUITest::OpenAboutDialog() { |
465 return RunCommandAsync(IDC_ABOUT); | 471 return RunCommandAsync(IDC_ABOUT); |
466 } | 472 } |
467 | 473 |
468 bool AutomatedUITest::OpenClearBrowsingDataDialog() { | 474 bool AutomatedUITest::OpenClearBrowsingDataDialog() { |
469 return RunCommandAsync(IDC_CLEAR_BROWSING_DATA); | 475 return RunCommandAsync(IDC_CLEAR_BROWSING_DATA); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 520 } |
515 | 521 |
516 bool AutomatedUITest::PressTabKey() { | 522 bool AutomatedUITest::PressTabKey() { |
517 return SimulateKeyPressInActiveWindow(base::VKEY_TAB, 0); | 523 return SimulateKeyPressInActiveWindow(base::VKEY_TAB, 0); |
518 } | 524 } |
519 | 525 |
520 bool AutomatedUITest::PressUpArrow() { | 526 bool AutomatedUITest::PressUpArrow() { |
521 return SimulateKeyPressInActiveWindow(base::VKEY_UP, 0); | 527 return SimulateKeyPressInActiveWindow(base::VKEY_UP, 0); |
522 } | 528 } |
523 | 529 |
| 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 |
524 bool AutomatedUITest::StarPage() { | 550 bool AutomatedUITest::StarPage() { |
525 return RunCommandAsync(IDC_STAR); | 551 return RunCommandAsync(IDC_STAR); |
526 } | 552 } |
527 | 553 |
528 bool AutomatedUITest::ViewSource() { | 554 bool AutomatedUITest::ViewSource() { |
529 return RunCommandAsync(IDC_VIEW_SOURCE); | 555 return RunCommandAsync(IDC_VIEW_SOURCE); |
530 } | 556 } |
531 | 557 |
532 bool AutomatedUITest::ZoomMinus() { | 558 bool AutomatedUITest::ZoomMinus() { |
533 return RunCommandAsync(IDC_ZOOM_MINUS); | 559 return RunCommandAsync(IDC_ZOOM_MINUS); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 779 } |
754 } | 780 } |
755 | 781 |
756 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { | 782 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { |
757 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 783 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
758 if (parsed_command_line.HasSwitch(kReproSwitch)) | 784 if (parsed_command_line.HasSwitch(kReproSwitch)) |
759 RunReproduction(); | 785 RunReproduction(); |
760 else | 786 else |
761 RunAutomatedUITest(); | 787 RunAutomatedUITest(); |
762 } | 788 } |
OLD | NEW |