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" |
11 #include "base/keyboard_codes.h" | 11 #include "base/keyboard_codes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "chrome/app/chrome_dll_resource.h" | 18 #include "chrome/app/chrome_dll_resource.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/character_encoding.h" | 20 #include "chrome/browser/character_encoding.h" |
21 #include "chrome/browser/view_ids.h" | 21 #include "chrome/browser/view_ids.h" |
22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
23 #include "chrome/common/env_vars.h" | 23 #include "chrome/common/env_vars.h" |
24 #include "chrome/common/libxml_utils.h" | 24 #include "chrome/common/libxml_utils.h" |
| 25 #include "chrome/common/url_constants.h" |
25 #include "chrome/test/automated_ui_tests/automated_ui_tests.h" | 26 #include "chrome/test/automated_ui_tests/automated_ui_tests.h" |
26 #include "chrome/test/automation/browser_proxy.h" | 27 #include "chrome/test/automation/browser_proxy.h" |
27 #include "chrome/test/automation/tab_proxy.h" | 28 #include "chrome/test/automation/tab_proxy.h" |
28 #include "chrome/test/automation/window_proxy.h" | 29 #include "chrome/test/automation/window_proxy.h" |
29 #include "chrome/test/ui/ui_test.h" | 30 #include "chrome/test/ui/ui_test.h" |
30 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
31 | 32 |
32 #if defined(TOOLKIT_VIEWS) | 33 #if defined(TOOLKIT_VIEWS) |
33 #include "views/view.h" | 34 #include "views/view.h" |
34 #endif | 35 #endif |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 did_complete_action = GoOffTheRecord(); | 340 did_complete_action = GoOffTheRecord(); |
340 } else if (LowerCaseEqualsASCII(action, "history")) { | 341 } else if (LowerCaseEqualsASCII(action, "history")) { |
341 did_complete_action = ShowHistory(); | 342 did_complete_action = ShowHistory(); |
342 } else if (LowerCaseEqualsASCII(action, "home")) { | 343 } else if (LowerCaseEqualsASCII(action, "home")) { |
343 did_complete_action = Home(); | 344 did_complete_action = Home(); |
344 } else if (LowerCaseEqualsASCII(action, "importsettings")) { | 345 } else if (LowerCaseEqualsASCII(action, "importsettings")) { |
345 did_complete_action = OpenImportSettingsDialog(); | 346 did_complete_action = OpenImportSettingsDialog(); |
346 } else if (LowerCaseEqualsASCII(action, "javascriptconsole")) { | 347 } else if (LowerCaseEqualsASCII(action, "javascriptconsole")) { |
347 did_complete_action = JavaScriptConsole(); | 348 did_complete_action = JavaScriptConsole(); |
348 } else if (LowerCaseEqualsASCII(action, "navigate")) { | 349 } else if (LowerCaseEqualsASCII(action, "navigate")) { |
349 std::string url = "about:blank"; | 350 std::string url = chrome::kAboutBlankURL; |
350 if (init_reader_.NodeAttribute("url", &url)) { | 351 if (init_reader_.NodeAttribute("url", &url)) { |
351 xml_writer_.AddAttribute("url", url); | 352 xml_writer_.AddAttribute("url", url); |
352 } | 353 } |
353 GURL test_url(url); | 354 GURL test_url(url); |
354 did_complete_action = Navigate(test_url); | 355 did_complete_action = Navigate(test_url); |
355 } else if (LowerCaseEqualsASCII(action, "newtab")) { | 356 } else if (LowerCaseEqualsASCII(action, "newtab")) { |
356 did_complete_action = NewTab(); | 357 did_complete_action = NewTab(); |
357 } else if (LowerCaseEqualsASCII(action, "openwindow")) { | 358 } else if (LowerCaseEqualsASCII(action, "openwindow")) { |
358 did_complete_action = OpenAndActivateNewBrowserWindow(NULL); | 359 did_complete_action = OpenAndActivateNewBrowserWindow(NULL); |
359 } else if (LowerCaseEqualsASCII(action, "options")) { | 360 } else if (LowerCaseEqualsASCII(action, "options")) { |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 return_value = return_value && | 618 return_value = return_value && |
618 DoAction(kTestDialogPossibleActions[action_index]); | 619 DoAction(kTestDialogPossibleActions[action_index]); |
619 if (DidCrash(false)) | 620 if (DidCrash(false)) |
620 break; | 621 break; |
621 } | 622 } |
622 return DoAction("PressEscapeKey") && return_value; | 623 return DoAction("PressEscapeKey") && return_value; |
623 } | 624 } |
624 | 625 |
625 bool AutomatedUITest::ForceCrash() { | 626 bool AutomatedUITest::ForceCrash() { |
626 scoped_refptr<TabProxy> tab(GetActiveTab()); | 627 scoped_refptr<TabProxy> tab(GetActiveTab()); |
627 GURL test_url("about:crash"); | 628 GURL test_url(chrome::kAboutCrashURL); |
628 bool did_timeout; | 629 bool did_timeout; |
629 tab->NavigateToURLWithTimeout(test_url, 1, kDebuggingTimeoutMsec, | 630 tab->NavigateToURLWithTimeout(test_url, 1, kDebuggingTimeoutMsec, |
630 &did_timeout); | 631 &did_timeout); |
631 if (!did_timeout) { | 632 if (!did_timeout) { |
632 AddInfoAttribute("expected_crash"); | 633 AddInfoAttribute("expected_crash"); |
633 return false; | 634 return false; |
634 } | 635 } |
635 return true; | 636 return true; |
636 } | 637 } |
637 | 638 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 779 } |
779 } | 780 } |
780 | 781 |
781 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { | 782 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { |
782 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 783 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
783 if (parsed_command_line.HasSwitch(kReproSwitch)) | 784 if (parsed_command_line.HasSwitch(kReproSwitch)) |
784 RunReproduction(); | 785 RunReproduction(); |
785 else | 786 else |
786 RunAutomatedUITest(); | 787 RunAutomatedUITest(); |
787 } | 788 } |
OLD | NEW |