OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 if (!tab_proxy.get()) | 561 if (!tab_proxy.get()) |
562 return FilePath(); | 562 return FilePath(); |
563 | 563 |
564 FilePath download_directory; | 564 FilePath download_directory; |
565 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory)); | 565 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_directory)); |
566 return download_directory; | 566 return download_directory; |
567 } | 567 } |
568 | 568 |
569 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { | 569 void UITestBase::CloseBrowserAsync(BrowserProxy* browser) const { |
570 ASSERT_TRUE(server_->Send( | 570 ASSERT_TRUE(server_->Send( |
571 new AutomationMsg_CloseBrowserRequestAsync(0, browser->handle()))); | 571 new AutomationMsg_CloseBrowserRequestAsync(browser->handle()))); |
572 } | 572 } |
573 | 573 |
574 bool UITestBase::CloseBrowser(BrowserProxy* browser, | 574 bool UITestBase::CloseBrowser(BrowserProxy* browser, |
575 bool* application_closed) const { | 575 bool* application_closed) const { |
576 DCHECK(application_closed); | 576 DCHECK(application_closed); |
577 if (!browser->is_valid() || !browser->handle()) | 577 if (!browser->is_valid() || !browser->handle()) |
578 return false; | 578 return false; |
579 | 579 |
580 bool result = true; | 580 bool result = true; |
581 | 581 |
582 bool succeeded = server_->Send(new AutomationMsg_CloseBrowser( | 582 bool succeeded = server_->Send(new AutomationMsg_CloseBrowser( |
583 0, browser->handle(), &result, application_closed)); | 583 browser->handle(), &result, application_closed)); |
584 | 584 |
585 if (!succeeded) | 585 if (!succeeded) |
586 return false; | 586 return false; |
587 | 587 |
588 if (*application_closed) { | 588 if (*application_closed) { |
589 // Let's wait until the process dies (if it is not gone already). | 589 // Let's wait until the process dies (if it is not gone already). |
590 bool success = base::WaitForSingleProcess(process_, base::kNoTimeout); | 590 bool success = base::WaitForSingleProcess(process_, base::kNoTimeout); |
591 EXPECT_TRUE(success); | 591 EXPECT_TRUE(success); |
592 } | 592 } |
593 | 593 |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 incorrect_state_count++; | 1190 incorrect_state_count++; |
1191 } | 1191 } |
1192 | 1192 |
1193 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 1193 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() |
1194 << " seconds" | 1194 << " seconds" |
1195 << " call failed " << fail_count << " times" | 1195 << " call failed " << fail_count << " times" |
1196 << " state was incorrect " << incorrect_state_count << " times"; | 1196 << " state was incorrect " << incorrect_state_count << " times"; |
1197 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 1197 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; |
1198 return false; | 1198 return false; |
1199 } | 1199 } |
OLD | NEW |