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

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

Issue 8376001: UI test for browser termination with beforeunload handler. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: BrowserTestBeforeUnload only for cros 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 19 matching lines...) Expand all
30 #include "base/threading/platform_thread.h" 30 #include "base/threading/platform_thread.h"
31 #include "base/time.h" 31 #include "base/time.h"
32 #include "base/utf_string_conversions.h" 32 #include "base/utf_string_conversions.h"
33 #include "chrome/app/chrome_command_ids.h" 33 #include "chrome/app/chrome_command_ids.h"
34 #include "chrome/browser/net/url_fixer_upper.h" 34 #include "chrome/browser/net/url_fixer_upper.h"
35 #include "chrome/common/automation_messages.h" 35 #include "chrome/common/automation_messages.h"
36 #include "chrome/common/chrome_constants.h" 36 #include "chrome/common/chrome_constants.h"
37 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
38 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
39 #include "chrome/common/logging_chrome.h" 39 #include "chrome/common/logging_chrome.h"
40 #include "chrome/common/pref_names.h"
40 #include "chrome/common/url_constants.h" 41 #include "chrome/common/url_constants.h"
41 #include "chrome/test/automation/automation_proxy.h" 42 #include "chrome/test/automation/automation_proxy.h"
42 #include "chrome/test/automation/browser_proxy.h" 43 #include "chrome/test/automation/browser_proxy.h"
43 #include "chrome/test/automation/javascript_execution_controller.h" 44 #include "chrome/test/automation/javascript_execution_controller.h"
44 #include "chrome/test/automation/proxy_launcher.h" 45 #include "chrome/test/automation/proxy_launcher.h"
45 #include "chrome/test/automation/tab_proxy.h" 46 #include "chrome/test/automation/tab_proxy.h"
46 #include "chrome/test/automation/window_proxy.h" 47 #include "chrome/test/automation/window_proxy.h"
47 #include "chrome/test/base/chrome_process_util.h" 48 #include "chrome/test/base/chrome_process_util.h"
48 #include "chrome/test/base/test_switches.h" 49 #include "chrome/test/base/test_switches.h"
49 #include "content/common/debug_flags.h" 50 #include "content/common/debug_flags.h"
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles); 795 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms() / kCycles);
795 } 796 }
796 797
797 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF() 798 LOG(INFO) << "Elapsed time: " << (base::Time::Now() - start).InSecondsF()
798 << " seconds" 799 << " seconds"
799 << " call failed " << fail_count << " times" 800 << " call failed " << fail_count << " times"
800 << " state was incorrect " << incorrect_state_count << " times"; 801 << " state was incorrect " << incorrect_state_count << " times";
801 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__; 802 ADD_FAILURE() << "Timeout reached in " << __FUNCTION__;
802 return false; 803 return false;
803 } 804 }
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