Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: chrome/test/ui/ui_test.cc

Issue 8390041: Call VerifyCleanExit in TerminateBrowser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: missed a file Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
766 // Make sure the UMA metrics say we didn't crash.
767 scoped_ptr<DictionaryValue> local_prefs(GetLocalState());
768 bool exited_cleanly;
769 ASSERT_TRUE(local_prefs.get());
770 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilityExitedCleanly,
771 &exited_cleanly));
772 ASSERT_TRUE(exited_cleanly);
773
774 // And that session end was successful.
775 bool session_end_completed;
776 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilitySessionEndCompleted,
777 &session_end_completed));
778 ASSERT_TRUE(session_end_completed);
779
780 // Make sure session restore says we didn't crash.
781 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences());
782 ASSERT_TRUE(profile_prefs.get());
783 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly,
784 &exited_cleanly));
785 ASSERT_TRUE(exited_cleanly);
765 } 786 }
766 787
767 void UITest::NavigateToURLAsync(const GURL& url) { 788 void UITest::NavigateToURLAsync(const GURL& url) {
768 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); 789 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
769 ASSERT_TRUE(tab_proxy.get()); 790 ASSERT_TRUE(tab_proxy.get());
770 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(url)); 791 ASSERT_TRUE(tab_proxy->NavigateToURLAsync(url));
771 } 792 }
772 793
773 bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser, 794 bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser,
774 bool wait_for_open) { 795 bool wait_for_open) {
(...skipping 20 matching lines...) Expand all
795 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); 816 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles);
796 } 817 }
797 818
798 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() 819 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
799 << " seconds" 820 << " seconds"
800 << " call failed " << fail_count << " times" 821 << " call failed " << fail_count << " times"
801 << " state was incorrect " << incorrect_state_count << " times"; 822 << " state was incorrect " << incorrect_state_count << " times";
802 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; 823 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__;
803 return false; 824 return false;
804 } 825 }
805
806 // TODO(achuith): Call VerifyCleanExit from TerminateBrowser.
807 // http://crbug.com/101390
808 void UITest::VerifyCleanExit() {
809 // Make sure the UMA metrics say we didn't crash.
810 scoped_ptr<DictionaryValue> local_prefs(GetLocalState());
811 bool exited_cleanly;
812 ASSERT_TRUE(local_prefs.get());
813 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilityExitedCleanly,
814 &exited_cleanly));
815 ASSERT_TRUE(exited_cleanly);
816
817 // And that session end was successful.
818 bool session_end_completed;
819 ASSERT_TRUE(local_prefs->GetBoolean(prefs::kStabilitySessionEndCompleted,
820 &session_end_completed));
821 ASSERT_TRUE(session_end_completed);
822
823 // Make sure session restore says we didn't crash.
824 scoped_ptr<DictionaryValue> profile_prefs(GetDefaultProfilePreferences());
825 ASSERT_TRUE(profile_prefs.get());
826 ASSERT_TRUE(profile_prefs->GetBoolean(prefs::kSessionExitedCleanly,
827 &exited_cleanly));
828 ASSERT_TRUE(exited_cleanly);
829 }
OLDNEW
« no previous file with comments | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698