summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 23:52:26 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 23:52:26 +0000
commit24b7975a697c6f834c57a2bc8d76bcbd7243b66c (patch)
treed70fcdcb6994f41dbf688229b08d13126ed66803 /chrome/browser
parent0e65dc5a8e5709a578ede509843db311ccefdca5 (diff)
downloadchromium_src-24b7975a697c6f834c57a2bc8d76bcbd7243b66c.zip
chromium_src-24b7975a697c6f834c57a2bc8d76bcbd7243b66c.tar.gz
chromium_src-24b7975a697c6f834c57a2bc8d76bcbd7243b66c.tar.bz2
Try to shutdown the browser more peacefully before using more brutal methods.
Also, do proper cleanup before browser shutdown in MetricsService UI test. I hope this will reduce the flakiness. TEST=none BUG=none Review URL: http://codereview.chromium.org/173023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/metrics/metrics_service_uitest.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc
index cf453a5..da25d8e 100644
--- a/chrome/browser/metrics/metrics_service_uitest.cc
+++ b/chrome/browser/metrics/metrics_service_uitest.cc
@@ -31,18 +31,18 @@ class MetricsServiceTest : public UITest {
// Open a few tabs of random content
void OpenTabs() {
- window_ = automation()->GetBrowserWindow(0);
- ASSERT_TRUE(window_.get());
+ scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0);
+ ASSERT_TRUE(window.get());
FilePath page1_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page1_path));
page1_path = page1_path.AppendASCII("title2.html");
- ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page1_path)));
+ ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page1_path)));
FilePath page2_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &page2_path));
page2_path = page2_path.AppendASCII("iframe.html");
- ASSERT_TRUE(window_->AppendTab(net::FilePathToFileURL(page2_path)));
+ ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(page2_path)));
}
// Get a PrefService whose contents correspond to the Local State file
@@ -55,14 +55,6 @@ class MetricsServiceTest : public UITest {
PrefService* local_state(new PrefService(local_state_path, NULL));
return local_state;
}
-
- virtual void TearDown() {
- window_ = NULL;
- UITest::TearDown();
- }
-
- protected:
- scoped_refptr<BrowserProxy> window_;
};
TEST_F(MetricsServiceTest, CloseRenderersNormally) {
@@ -87,15 +79,23 @@ TEST_F(MetricsServiceTest, CrashRenderers) {
OpenTabs();
- // kill the process for one of the tabs
- scoped_refptr<TabProxy> tab(window_->GetTab(1));
- ASSERT_TRUE(tab.get());
+ {
+ // Limit the lifetime of various automation proxies used here. We must
+ // destroy them before calling QuitBrowser.
+
+ scoped_refptr<BrowserProxy> window = automation()->GetBrowserWindow(0);
+ ASSERT_TRUE(window.get());
+
+ // Kill the process for one of the tabs.
+ scoped_refptr<TabProxy> tab(window->GetTab(1));
+ ASSERT_TRUE(tab.get());
// Only windows implements the crash service for now.
#if defined(OS_WIN)
- expected_crashes_ = 1;
+ expected_crashes_ = 1;
#endif
- tab->NavigateToURLAsync(GURL("about:crash"));
+ tab->NavigateToURLAsync(GURL("about:crash"));
+ }
// Give the browser a chance to notice the crashed tab.
PlatformThread::Sleep(1000);