summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 01:43:04 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 01:43:04 +0000
commit28de7d94b52d84165475ca2b6d98d556b0feaffb (patch)
tree5d986190ce73e6408debcc08465a83c5354788f0 /chrome/browser
parent9d391c62e127172e069f17619a7e9b07328fae56 (diff)
downloadchromium_src-28de7d94b52d84165475ca2b6d98d556b0feaffb.zip
chromium_src-28de7d94b52d84165475ca2b6d98d556b0feaffb.tar.gz
chromium_src-28de7d94b52d84165475ca2b6d98d556b0feaffb.tar.bz2
Fix for crash on early return from browser_main.cc
BrowserImpl dtor assumes full construction of all sub-objects, this is not true at least in one case (the try chrome again toast). See bug for more details - Added a UI test to detect these shenaningans in all platforms - had to hack ui_tests a bit, I hope is palatable BUG=34799 TEST= UI test included Review URL: http://codereview.chromium.org/571017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_main.cc8
-rw-r--r--chrome/browser/first_run_win.cc5
-rw-r--r--chrome/browser/sanity_uitest.cc22
3 files changed, 31 insertions, 4 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 57dd2d9..ccb90c1 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -611,19 +611,21 @@ int BrowserMain(const MainFunctionParams& parameters) {
gtk_util::SetDefaultWindowIcon();
#endif
-#if defined(OS_WIN)
- // This is experimental code. See first_run_win.cc for more info.
std::string try_chrome =
parsed_command_line.GetSwitchValueASCII(switches::kTryChromeAgain);
if (!try_chrome.empty()) {
+#if defined(OS_WIN)
Upgrade::TryResult answer =
Upgrade::ShowTryChromeDialog(StringToInt(try_chrome));
if (answer == Upgrade::TD_NOT_NOW)
return ResultCodes::NORMAL_EXIT_CANCEL;
if (answer == Upgrade::TD_UNINSTALL_CHROME)
return ResultCodes::NORMAL_EXIT_EXP2;
+#else
+ // We don't support retention experiments on Mac or Linux.
+ return ResultCodes::NORMAL_EXIT;
+#endif // defined(OS_WIN)
}
-#endif // OS_WIN
BrowserInit browser_init;
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 3d2c86a..5a3078f 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -936,6 +936,11 @@ class TryChromeDialog : public views::ButtonListener,
} // namespace
Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
+ if (version > 10000) {
+ // This is a test value. We want to make sure we exercise
+ // returning this early. See EarlyReturnTest test harness.
+ return Upgrade::TD_NOT_NOW;
+ }
TryChromeDialog td;
return td.ShowModal();
}
diff --git a/chrome/browser/sanity_uitest.cc b/chrome/browser/sanity_uitest.cc
index 2eaded0..ab347bb 100644
--- a/chrome/browser/sanity_uitest.cc
+++ b/chrome/browser/sanity_uitest.cc
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/platform_thread.h"
+#include "chrome/common/chrome_switches.h"
class GoogleTest : public UITest {
protected:
@@ -45,5 +46,24 @@ TEST_F(ColumnLayout, Crash) {
// Make sure the navigation succeeded.
EXPECT_EQ(page_title, GetActiveTabTitle());
- // UIText will check if this crashed.
+ // UITest will check if this crashed.
+}
+
+// By passing kTryChromeAgain with a magic value > 10000 we cause chrome
+// to exit fairly early. This was the cause of crashes. See bug 34799.
+class EarlyReturnTest : public UITest {
+ public:
+ EarlyReturnTest() {
+ wait_for_initial_loads_ = false;
+ // We don't depend on these timeouts, they are set to the minimum so
+ // the automation server waits the minimun amount possible for the
+ // handshake that will never come.
+ set_command_execution_timeout_ms(1);
+ set_action_timeout_ms(1);
+ launch_arguments_.AppendSwitchWithValue(switches::kTryChromeAgain, "10001");
+ }
+};
+
+TEST_F(EarlyReturnTest, ToastCrasher) {
+ // UITest will check if this crashed.
}