OLD | NEW |
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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
7 #include "chrome/browser/ui/view_ids.h" | 7 #include "chrome/browser/ui/view_ids.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/test/automation/automation_proxy.h" | 9 #include "chrome/test/automation/automation_proxy.h" |
10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 // Tests terminating the browser with a beforeunload handler. | 318 // Tests terminating the browser with a beforeunload handler. |
319 // Currently only ChromeOS shuts down gracefully. | 319 // Currently only ChromeOS shuts down gracefully. |
320 #if defined(OS_CHROMEOS) | 320 #if defined(OS_CHROMEOS) |
321 TEST_F(UnloadTest, BrowserTerminateBeforeUnload) { | 321 TEST_F(UnloadTest, BrowserTerminateBeforeUnload) { |
322 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 322 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
323 ASSERT_TRUE(browser.get()); | 323 ASSERT_TRUE(browser.get()); |
324 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); | 324 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); |
325 TerminateBrowser(); | 325 TerminateBrowser(); |
326 VerifyCleanExit(); | |
327 } | 326 } |
328 #endif | 327 #endif |
329 | 328 |
330 #if defined(OS_LINUX) | 329 #if defined(OS_LINUX) |
331 // Fails sometimes on Linux valgrind. http://crbug.com/45675 | 330 // Fails sometimes on Linux valgrind. http://crbug.com/45675 |
332 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ | 331 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ |
333 FLAKY_BrowserCloseWithInnerFocusedFrame | 332 FLAKY_BrowserCloseWithInnerFocusedFrame |
334 #else | 333 #else |
335 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ | 334 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ |
336 BrowserCloseWithInnerFocusedFrame | 335 BrowserCloseWithInnerFocusedFrame |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); | 476 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); |
478 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); | 477 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); |
479 ASSERT_TRUE(main_tab.get()); | 478 ASSERT_TRUE(main_tab.get()); |
480 std::wstring main_title; | 479 std::wstring main_title; |
481 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); | 480 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); |
482 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); | 481 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); |
483 } | 482 } |
484 | 483 |
485 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 484 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
486 // and multiple windows. | 485 // and multiple windows. |
OLD | NEW |