| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <string> | |
| 6 | |
| 7 #include "base/message_loop.h" | |
| 8 #include "chrome/browser/browser.h" | |
| 9 #include "chrome/browser/renderer_host/render_process_host.h" | |
| 10 #include "chrome/browser/renderer_host/web_cache_manager.h" | |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 12 #include "chrome/test/in_process_browser_test.h" | |
| 13 #include "chrome/test/ui_test_utils.h" | |
| 14 #include "testing/gtest/include/gtest/gtest.h" | |
| 15 | |
| 16 class WebCacheManagerBrowserTest : public InProcessBrowserTest { | |
| 17 }; | |
| 18 | |
| 19 // Regression test for http://crbug.com/12362. If a renderer crashes and the | |
| 20 // user navigates to another tab and back, the browser doesn't crash. | |
| 21 // TODO(jam): http://crbug.com/15288 disabled because it fails on the build bot. | |
| 22 IN_PROC_BROWSER_TEST_F(WebCacheManagerBrowserTest, DISABLED_CrashOnceOnly) { | |
| 23 GURL url(ui_test_utils::GetTestUrl(L"google", L"google.html")); | |
| 24 | |
| 25 ui_test_utils::NavigateToURL(browser(), url); | |
| 26 | |
| 27 browser()->NewTab(); | |
| 28 ui_test_utils::NavigateToURL(browser(), url); | |
| 29 | |
| 30 TabContents* tab = browser()->GetTabContentsAt(0); | |
| 31 ASSERT_TRUE(tab != NULL); | |
| 32 base::KillProcess( | |
| 33 tab->process()->process().handle(), base::PROCESS_END_KILLED_BY_USER, | |
| 34 true); | |
| 35 | |
| 36 browser()->SelectTabContentsAt(0, true); | |
| 37 browser()->NewTab(); | |
| 38 ui_test_utils::NavigateToURL(browser(), url); | |
| 39 | |
| 40 browser()->SelectTabContentsAt(0, true); | |
| 41 browser()->NewTab(); | |
| 42 ui_test_utils::NavigateToURL(browser(), url); | |
| 43 | |
| 44 // We would have crashed at the above line with the bug. | |
| 45 | |
| 46 browser()->SelectTabContentsAt(0, true); | |
| 47 browser()->CloseTab(); | |
| 48 browser()->SelectTabContentsAt(0, true); | |
| 49 browser()->CloseTab(); | |
| 50 browser()->SelectTabContentsAt(0, true); | |
| 51 browser()->CloseTab(); | |
| 52 | |
| 53 ui_test_utils::NavigateToURL(browser(), url); | |
| 54 | |
| 55 EXPECT_EQ( | |
| 56 WebCacheManager::GetInstance()->active_renderers_.size(), 1U); | |
| 57 EXPECT_EQ( | |
| 58 WebCacheManager::GetInstance()->inactive_renderers_.size(), 0U); | |
| 59 EXPECT_EQ( | |
| 60 WebCacheManager::GetInstance()->stats_.size(), 1U); | |
| 61 } | |
| OLD | NEW |