| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" | 
| 6 | 6 | 
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) | 
| 8 #include <signal.h> | 8 #include <signal.h> | 
| 9 #include <sys/types.h> | 9 #include <sys/types.h> | 
| 10 #endif | 10 #endif | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 82     : launch_arguments_(CommandLine::NO_PROGRAM), | 82     : launch_arguments_(CommandLine::NO_PROGRAM), | 
| 83       expected_errors_(0), | 83       expected_errors_(0), | 
| 84       expected_crashes_(0), | 84       expected_crashes_(0), | 
| 85       homepage_(chrome::kAboutBlankURL), | 85       homepage_(chrome::kAboutBlankURL), | 
| 86       wait_for_initial_loads_(true), | 86       wait_for_initial_loads_(true), | 
| 87       dom_automation_enabled_(false), | 87       dom_automation_enabled_(false), | 
| 88       show_window_(false), | 88       show_window_(false), | 
| 89       clear_profile_(true), | 89       clear_profile_(true), | 
| 90       include_testing_id_(true), | 90       include_testing_id_(true), | 
| 91       enable_file_cookies_(true), | 91       enable_file_cookies_(true), | 
|  | 92       enable_chrome_branding_(true), | 
| 92       profile_type_(ProxyLauncher::DEFAULT_THEME) { | 93       profile_type_(ProxyLauncher::DEFAULT_THEME) { | 
| 93   PathService::Get(chrome::DIR_APP, &browser_directory_); | 94   PathService::Get(chrome::DIR_APP, &browser_directory_); | 
| 94   PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 95   PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 
| 95 } | 96 } | 
| 96 | 97 | 
| 97 UITestBase::UITestBase(MessageLoop::Type msg_loop_type) | 98 UITestBase::UITestBase(MessageLoop::Type msg_loop_type) | 
| 98     : launch_arguments_(CommandLine::NO_PROGRAM), | 99     : launch_arguments_(CommandLine::NO_PROGRAM), | 
| 99       expected_errors_(0), | 100       expected_errors_(0), | 
| 100       expected_crashes_(0), | 101       expected_crashes_(0), | 
| 101       wait_for_initial_loads_(true), | 102       wait_for_initial_loads_(true), | 
| 102       dom_automation_enabled_(false), | 103       dom_automation_enabled_(false), | 
| 103       show_window_(false), | 104       show_window_(false), | 
| 104       clear_profile_(true), | 105       clear_profile_(true), | 
| 105       include_testing_id_(true), | 106       include_testing_id_(true), | 
| 106       enable_file_cookies_(true), | 107       enable_file_cookies_(true), | 
|  | 108       enable_chrome_branding_(true), | 
| 107       profile_type_(ProxyLauncher::DEFAULT_THEME) { | 109       profile_type_(ProxyLauncher::DEFAULT_THEME) { | 
| 108   PathService::Get(chrome::DIR_APP, &browser_directory_); | 110   PathService::Get(chrome::DIR_APP, &browser_directory_); | 
| 109   PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 111   PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 
| 110 } | 112 } | 
| 111 | 113 | 
| 112 UITestBase::~UITestBase() {} | 114 UITestBase::~UITestBase() {} | 
| 113 | 115 | 
| 114 void UITestBase::SetUp() { | 116 void UITestBase::SetUp() { | 
| 115   // Tests that do a session restore (e.g. SessionRestoreUITest, StartupTest) | 117   // Tests that do a session restore (e.g. SessionRestoreUITest, StartupTest) | 
| 116   // call SetUp() multiple times because they restart the browser mid-test. | 118   // call SetUp() multiple times because they restart the browser mid-test. | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 167 void UITestBase::set_action_timeout_ms(int timeout) { | 169 void UITestBase::set_action_timeout_ms(int timeout) { | 
| 168   automation()->set_action_timeout_ms(timeout); | 170   automation()->set_action_timeout_ms(timeout); | 
| 169   VLOG(1) << "Automation action timeout set to " << timeout << " ms"; | 171   VLOG(1) << "Automation action timeout set to " << timeout << " ms"; | 
| 170 } | 172 } | 
| 171 | 173 | 
| 172 ProxyLauncher* UITestBase::CreateProxyLauncher() { | 174 ProxyLauncher* UITestBase::CreateProxyLauncher() { | 
| 173   return new AnonymousProxyLauncher(false); | 175   return new AnonymousProxyLauncher(false); | 
| 174 } | 176 } | 
| 175 | 177 | 
| 176 ProxyLauncher::LaunchState UITestBase::DefaultLaunchState() { | 178 ProxyLauncher::LaunchState UITestBase::DefaultLaunchState() { | 
| 177   FilePath browser_executable = browser_directory_.Append( | 179   if (enable_chrome_branding_) | 
| 178       chrome::kBrowserProcessExecutablePath); | 180     FilePath browser_executable = browser_directory_.Append( | 
|  | 181         chrome::kBrowserProcessExecutablePath); | 
|  | 182   else | 
|  | 183     FilePath browser_executable = browser_directory_.Append( | 
|  | 184         chrome::kBrowserProcessExecutablePathChromium); | 
| 179   CommandLine command(browser_executable); | 185   CommandLine command(browser_executable); | 
| 180   command.AppendArguments(launch_arguments_, false); | 186   command.AppendArguments(launch_arguments_, false); | 
| 181   ProxyLauncher::LaunchState state = | 187   ProxyLauncher::LaunchState state = | 
| 182       { clear_profile_, template_user_data_, profile_type_, | 188       { clear_profile_, template_user_data_, profile_type_, | 
| 183         command, include_testing_id_, show_window_ }; | 189         command, include_testing_id_, show_window_ }; | 
| 184   return state; | 190   return state; | 
| 185 } | 191 } | 
| 186 | 192 | 
| 187 bool UITestBase::ShouldFilterInet() { | 193 bool UITestBase::ShouldFilterInet() { | 
| 188   return true; | 194   return true; | 
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 759     base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); | 765     base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); | 
| 760   } | 766   } | 
| 761 | 767 | 
| 762   LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 768   LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 
| 763             << " seconds" | 769             << " seconds" | 
| 764             << " call failed " << fail_count << " times" | 770             << " call failed " << fail_count << " times" | 
| 765             << " state was incorrect " << incorrect_state_count << " times"; | 771             << " state was incorrect " << incorrect_state_count << " times"; | 
| 766   ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 772   ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 
| 767   return false; | 773   return false; | 
| 768 } | 774 } | 
| OLD | NEW | 
|---|