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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 // Give it a chance to catch up. | 755 // Give it a chance to catch up. |
756 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); | 756 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); |
757 } | 757 } |
758 | 758 |
759 ADD_FAILURE() << "Timeout reached in WaitForFindWindowVisibilityChange"; | 759 ADD_FAILURE() << "Timeout reached in WaitForFindWindowVisibilityChange"; |
760 return false; | 760 return false; |
761 } | 761 } |
762 | 762 |
763 void UITest::TerminateBrowser() { | 763 void UITest::TerminateBrowser() { |
764 launcher_->TerminateBrowser(); | 764 launcher_->TerminateBrowser(); |
765 VerifyCleanExit(); | |
Paweł Hajdan Jr.
2011/10/26 18:38:20
Could you remove VerifyCleanExit from the callers
achuithb
2011/10/26 18:55:44
Done.
| |
765 } | 766 } |
766 | 767 |
767 void UITest::NavigateToURLAsync(const GURL& url) { | 768 void UITest::NavigateToURLAsync(const GURL& url) { |
768 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 769 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
769 ASSERT_TRUE(tab_proxy.get()); | 770 ASSERT_TRUE(tab_proxy.get()); |
770 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(url)); | 771 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(url)); |
771 } | 772 } |
772 | 773 |
773 bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser, | 774 bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser, |
774 bool wait_for_open) { | 775 bool wait_for_open) { |
(...skipping 21 matching lines...) Expand all Loading... | |
796 } | 797 } |
797 | 798 |
798 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() | 799 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() |
799 << " seconds" | 800 << " seconds" |
800 << " call failed " << fail_count << " times" | 801 << " call failed " << fail_count << " times" |
801 << " state was incorrect " << incorrect_state_count << " times"; | 802 << " state was incorrect " << incorrect_state_count << " times"; |
802 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; | 803 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; |
803 return false; | 804 return false; |
804 } | 805 } |
805 | 806 |
806 // TODO(achuith): Call VerifyCleanExit from TerminateBrowser. | |
807 // http://crbug.com/101390 | |
808 void UITest::VerifyCleanExit() { | 807 void UITest::VerifyCleanExit() { |
809 // Make sure the UMA metrics say we didn't crash. | 808 // Make sure the UMA metrics say we didn't crash. |
810 scoped_ptr<DictionaryValue> local_prefs(GetLocalState()); | 809 scoped_ptr<DictionaryValue> local_prefs(GetLocalState()); |
811 bool exited_cleanly; | 810 bool exited_cleanly; |
812 ASSERT_TRUE(local_prefs.get()); | 811 ASSERT_TRUE(local_prefs.get()); |
813 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilityExitedCleanly, | 812 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilityExitedCleanly, |
814 &exited_cleanly)); | 813 &exited_cleanly)); |
815 ASSERT_TRUE(exited_cleanly); | 814 ASSERT_TRUE(exited_cleanly); |
816 | 815 |
817 // And that session end was successful. | 816 // And that session end was successful. |
818 bool session_end_completed; | 817 bool session_end_completed; |
819 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilitySessionEndCompleted, | 818 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilitySessionEndCompleted, |
820 &session_end_completed)); | 819 &session_end_completed)); |
821 ASSERT_TRUE(session_end_completed); | 820 ASSERT_TRUE(session_end_completed); |
822 | 821 |
823 // Make sure session restore says we didn't crash. | 822 // Make sure session restore says we didn't crash. |
824 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); | 823 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences()); |
825 ASSERT_TRUE(profile_prefs.get()); | 824 ASSERT_TRUE(profile_prefs.get()); |
826 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly, | 825 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly, |
827 &exited_cleanly)); | 826 &exited_cleanly)); |
828 ASSERT_TRUE(exited_cleanly); | 827 ASSERT_TRUE(exited_cleanly); |
829 } | 828 } |
OLD | NEW |