| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "app/message_box_flags.h" | 5 #include "app/message_box_flags.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/platform_thread.h" | 7 #include "base/platform_thread.h" |
| 8 #include "chrome/browser/net/url_request_mock_http_job.h" | 8 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 9 #include "chrome/browser/view_ids.h" | 9 #include "chrome/browser/view_ids.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // we just wait a short period. | 317 // we just wait a short period. |
| 318 CrashAwareSleep(500); | 318 CrashAwareSleep(500); |
| 319 ASSERT_TRUE(IsBrowserRunning()); | 319 ASSERT_TRUE(IsBrowserRunning()); |
| 320 | 320 |
| 321 CloseBrowserAsync(browser.get()); | 321 CloseBrowserAsync(browser.get()); |
| 322 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); | 322 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); |
| 323 WaitForBrowserClosed(); | 323 WaitForBrowserClosed(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 #if defined(OS_LINUX) | 326 #if defined(OS_LINUX) |
| 327 // Fails sometimes on Linux valgrind. http://crbug.com/32615 | 327 // Fails sometimes on Linux valgrind. http://crbug.com/45675 |
| 328 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ | 328 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ |
| 329 FLAKY_BrowserCloseWithInnerFocusedFrame | 329 FLAKY_BrowserCloseWithInnerFocusedFrame |
| 330 #else | 330 #else |
| 331 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ | 331 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ |
| 332 BrowserCloseWithInnerFocusedFrame | 332 BrowserCloseWithInnerFocusedFrame |
| 333 #endif | 333 #endif |
| 334 | 334 |
| 335 // Tests closing the browser and clicking OK in the beforeunload confirm dialog | 335 // Tests closing the browser and clicking OK in the beforeunload confirm dialog |
| 336 // if an inner frame has the focus. See crbug.com/32615. | 336 // if an inner frame has the focus. See crbug.com/32615. |
| 337 TEST_F(UnloadTest, MAYBE_BrowserCloseWithInnerFocusedFrame) { | 337 TEST_F(UnloadTest, MAYBE_BrowserCloseWithInnerFocusedFrame) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 407 |
| 408 #if defined(OS_MACOSX) | 408 #if defined(OS_MACOSX) |
| 409 // http://crbug.com/45162 | 409 // http://crbug.com/45162 |
| 410 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ | 410 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ |
| 411 DISABLED_BrowserCloseTabWhenOtherTabHasListener | 411 DISABLED_BrowserCloseTabWhenOtherTabHasListener |
| 412 #elif defined(OS_WIN) | 412 #elif defined(OS_WIN) |
| 413 // http://crbug.com/45281 | 413 // http://crbug.com/45281 |
| 414 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ | 414 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ |
| 415 DISABLED_BrowserCloseTabWhenOtherTabHasListener | 415 DISABLED_BrowserCloseTabWhenOtherTabHasListener |
| 416 #else | 416 #else |
| 417 // Flaky on Linux as well. http://crbug.com/45562 | 417 // Flaky on Linux under valgrind. http://crbug.com/46781 |
| 418 // TODO(stuartmorgan): Switch to just disabling for valgrind. |
| 418 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ | 419 #define MAYBE_BrowserCloseTabWhenOtherTabHasListener \ |
| 419 FLAKY_BrowserCloseTabWhenOtherTabHasListener | 420 FLAKY_BrowserCloseTabWhenOtherTabHasListener |
| 420 #endif | 421 #endif |
| 421 | 422 |
| 422 // Tests that if there's a renderer process with two tabs, one of which has an | 423 // Tests that if there's a renderer process with two tabs, one of which has an |
| 423 // unload handler, and the other doesn't, the tab that doesn't have an unload | 424 // unload handler, and the other doesn't, the tab that doesn't have an unload |
| 424 // handler can be closed. | 425 // handler can be closed. |
| 425 TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) { | 426 TEST_F(UnloadTest, MAYBE_BrowserCloseTabWhenOtherTabHasListener) { |
| 426 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload"); | 427 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, L"only_one_unload"); |
| 427 | 428 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 449 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); | 450 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); |
| 450 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); | 451 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); |
| 451 ASSERT_TRUE(main_tab.get()); | 452 ASSERT_TRUE(main_tab.get()); |
| 452 std::wstring main_title; | 453 std::wstring main_title; |
| 453 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); | 454 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); |
| 454 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); | 455 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); |
| 455 } | 456 } |
| 456 | 457 |
| 457 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 458 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
| 458 // and multiple windows. | 459 // and multiple windows. |
| OLD | NEW |