| 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 |
| 11 | 11 |
| 12 #include <set> | 12 #include <set> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "app/sql/connection.h" | 15 #include "app/sql/connection.h" |
| 16 #include "base/base_switches.h" | 16 #include "base/base_switches.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/environment.h" | 18 #include "base/environment.h" |
| 19 #include "base/file_path.h" | 19 #include "base/file_path.h" |
| 20 #include "base/file_util.h" | 20 #include "base/file_util.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/memory/scoped_temp_dir.h" | 22 #include "base/memory/scoped_temp_dir.h" |
| 23 #include "base/path_service.h" | 23 #include "base/path_service.h" |
| 24 #include "base/process_util.h" | 24 #include "base/process_util.h" |
| 25 #include "base/string_number_conversions.h" | 25 #include "base/string_number_conversions.h" |
| 26 #include "base/string_split.h" | 26 #include "base/string_split.h" |
| 27 #include "base/test/test_file_util.h" | 27 #include "base/test/test_file_util.h" |
| 28 #include "base/test/test_timeouts.h" |
| 28 #include "base/threading/platform_thread.h" | 29 #include "base/threading/platform_thread.h" |
| 29 #include "base/time.h" | 30 #include "base/time.h" |
| 30 #include "base/utf_string_conversions.h" | 31 #include "base/utf_string_conversions.h" |
| 31 #include "chrome/app/chrome_command_ids.h" | 32 #include "chrome/app/chrome_command_ids.h" |
| 32 #include "chrome/browser/net/url_fixer_upper.h" | 33 #include "chrome/browser/net/url_fixer_upper.h" |
| 33 #include "chrome/common/automation_messages.h" | 34 #include "chrome/common/automation_messages.h" |
| 34 #include "chrome/common/chrome_constants.h" | 35 #include "chrome/common/chrome_constants.h" |
| 35 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
| 36 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 37 #include "chrome/common/logging_chrome.h" | 38 #include "chrome/common/logging_chrome.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 std::wstring error_msg = | 154 std::wstring error_msg = |
| 154 L"Encountered an unexpected crash in the program during this test."; | 155 L"Encountered an unexpected crash in the program during this test."; |
| 155 if (expected_crashes_ > 0 && actual_crashes == 0) { | 156 if (expected_crashes_ > 0 && actual_crashes == 0) { |
| 156 error_msg += L" "; | 157 error_msg += L" "; |
| 157 error_msg += kFailedNoCrashService; | 158 error_msg += kFailedNoCrashService; |
| 158 } | 159 } |
| 159 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg; | 160 EXPECT_EQ(expected_crashes_, actual_crashes) << error_msg; |
| 160 } | 161 } |
| 161 | 162 |
| 162 // TODO(phajdan.jr): get rid of set_command_execution_timeout_ms. | 163 int UITestBase::action_timeout_ms() { |
| 163 void UITestBase::set_command_execution_timeout_ms(int timeout) { | 164 return automation()->action_timeout_ms(); |
| 164 automation()->set_command_execution_timeout_ms(timeout); | 165 } |
| 165 VLOG(1) << "Automation command execution timeout set to " << timeout << " ms"; | 166 |
| 167 void UITestBase::set_action_timeout_ms(int timeout) { |
| 168 automation()->set_action_timeout_ms(timeout); |
| 169 VLOG(1) << "Automation action timeout set to " << timeout << " ms"; |
| 166 } | 170 } |
| 167 | 171 |
| 168 ProxyLauncher* UITestBase::CreateProxyLauncher() { | 172 ProxyLauncher* UITestBase::CreateProxyLauncher() { |
| 169 return new AnonymousProxyLauncher(false); | 173 return new AnonymousProxyLauncher(false); |
| 170 } | 174 } |
| 171 | 175 |
| 172 bool UITestBase::ShouldFilterInet() { | 176 bool UITestBase::ShouldFilterInet() { |
| 173 return true; | 177 return true; |
| 174 } | 178 } |
| 175 | 179 |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 incorrect_state_count++; | 872 incorrect_state_count++; |
| 869 } | 873 } |
| 870 | 874 |
| 871 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 875 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() |
| 872 << " seconds" | 876 << " seconds" |
| 873 << " call failed " << fail_count << " times" | 877 << " call failed " << fail_count << " times" |
| 874 << " state was incorrect " << incorrect_state_count << " times"; | 878 << " state was incorrect " << incorrect_state_count << " times"; |
| 875 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 879 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; |
| 876 return false; | 880 return false; |
| 877 } | 881 } |
| OLD | NEW |