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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void UITestBase::set_action_timeout_ms(int timeout) { | 167 void UITestBase::set_action_timeout_ms(int timeout) { |
168 automation()->set_action_timeout_ms(timeout); | 168 automation()->set_action_timeout_ms(timeout); |
169 VLOG(1) << "Automation action timeout set to " << timeout << " ms"; | 169 VLOG(1) << "Automation action timeout set to " << timeout << " ms"; |
170 } | 170 } |
171 | 171 |
172 ProxyLauncher* UITestBase::CreateProxyLauncher() { | 172 ProxyLauncher* UITestBase::CreateProxyLauncher() { |
173 return new AnonymousProxyLauncher(false); | 173 return new AnonymousProxyLauncher(false); |
174 } | 174 } |
175 | 175 |
176 ProxyLauncher::LaunchState UITestBase::DefaultLaunchState() { | 176 ProxyLauncher::LaunchState UITestBase::DefaultLaunchState() { |
177 FilePath browser_executable = browser_directory_.Append( | 177 FilePath browser_executable = browser_directory_.Append(GetExecutablePath()); |
178 chrome::kBrowserProcessExecutablePath); | |
179 CommandLine command(browser_executable); | 178 CommandLine command(browser_executable); |
180 command.AppendArguments(launch_arguments_, false); | 179 command.AppendArguments(launch_arguments_, false); |
181 ProxyLauncher::LaunchState state = | 180 ProxyLauncher::LaunchState state = |
182 { clear_profile_, template_user_data_, profile_type_, | 181 { clear_profile_, template_user_data_, profile_type_, |
183 command, include_testing_id_, show_window_ }; | 182 command, include_testing_id_, show_window_ }; |
184 return state; | 183 return state; |
185 } | 184 } |
186 | 185 |
187 bool UITestBase::ShouldFilterInet() { | 186 bool UITestBase::ShouldFilterInet() { |
188 return true; | 187 return true; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 398 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
400 EXPECT_TRUE(tab_proxy.get()); | 399 EXPECT_TRUE(tab_proxy.get()); |
401 if (!tab_proxy.get()) | 400 if (!tab_proxy.get()) |
402 return FilePath(); | 401 return FilePath(); |
403 | 402 |
404 FilePath download_directory; | 403 FilePath download_directory; |
405 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory)); | 404 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory)); |
406 return download_directory; | 405 return download_directory; |
407 } | 406 } |
408 | 407 |
| 408 const FilePath::CharType* UITestBase::GetExecutablePath() { |
| 409 if (launch_arguments_.HasSwitch(switches::kEnableChromiumBranding)) |
| 410 return chrome::kBrowserProcessExecutablePathChromium; |
| 411 return chrome::kBrowserProcessExecutablePath; |
| 412 } |
| 413 |
409 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { | 414 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { |
410 ASSERT_TRUE(automation()->Send( | 415 ASSERT_TRUE(automation()->Send( |
411 new AutomationMsg_CloseBrowserRequestAsync(browser->handle()))); | 416 new AutomationMsg_CloseBrowserRequestAsync(browser->handle()))); |
412 } | 417 } |
413 | 418 |
414 bool UITestBase::CloseBrowser(BrowserProxy* browser, | 419 bool UITestBase::CloseBrowser(BrowserProxy* browser, |
415 bool* application_closed) const { | 420 bool* application_closed) const { |
416 DCHECK(application_closed); | 421 DCHECK(application_closed); |
417 if (!browser->is_valid() || !browser->handle()) | 422 if (!browser->is_valid() || !browser->handle()) |
418 return false; | 423 return false; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); | 764 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); |
760 } | 765 } |
761 | 766 |
762 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 767 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() |
763 << " seconds" | 768 << " seconds" |
764 << " call failed " << fail_count << " times" | 769 << " call failed " << fail_count << " times" |
765 << " state was incorrect " << incorrect_state_count << " times"; | 770 << " state was incorrect " << incorrect_state_count << " times"; |
766 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 771 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; |
767 return false; | 772 return false; |
768 } | 773 } |
OLD | NEW |