Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/browser/unload_uitest.cc

Issue 8376001: UI test for browser termination with beforeunload handler. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Revert app terminating notification test Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 CloseBrowserAsync(browser.get()); 309 CloseBrowserAsync(browser.get());
310 ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK); 310 ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK);
311 311
312 int exit_code = -1; 312 int exit_code = -1;
313 ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit( 313 ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit(
314 TestTimeouts::action_max_timeout_ms(), &exit_code)); 314 TestTimeouts::action_max_timeout_ms(), &exit_code));
315 EXPECT_EQ(0, exit_code); // Expect a clean shutdown. 315 EXPECT_EQ(0, exit_code); // Expect a clean shutdown.
316 } 316 }
317 317
318 // Tests terminating the browser with a beforeunload handler.
319 TEST_F(UnloadTest, BrowserTerminateBeforeUnload) {
320 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
321 ASSERT_TRUE(browser.get());
322 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload");
323 TerminateBrowser();
324 VerifyCleanExit();
325 }
326
318 #if defined(OS_LINUX) 327 #if defined(OS_LINUX)
319 // Fails sometimes on Linux valgrind. http://crbug.com/45675 328 // Fails sometimes on Linux valgrind. http://crbug.com/45675
320 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ 329 #define MAYBE_BrowserCloseWithInnerFocusedFrame \
321 FLAKY_BrowserCloseWithInnerFocusedFrame 330 FLAKY_BrowserCloseWithInnerFocusedFrame
322 #else 331 #else
323 #define MAYBE_BrowserCloseWithInnerFocusedFrame \ 332 #define MAYBE_BrowserCloseWithInnerFocusedFrame \
324 BrowserCloseWithInnerFocusedFrame 333 BrowserCloseWithInnerFocusedFrame
325 #endif 334 #endif
326 335
327 // Tests closing the browser and clicking OK in the beforeunload confirm dialog 336 // Tests closing the browser and clicking OK in the beforeunload confirm dialog
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); 474 ASSERT_TRUE(browser->WaitForTabCountToBecome(1));
466 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); 475 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab());
467 ASSERT_TRUE(main_tab.get()); 476 ASSERT_TRUE(main_tab.get());
468 std::wstring main_title; 477 std::wstring main_title;
469 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); 478 EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
470 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); 479 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
471 } 480 }
472 481
473 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 482 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
474 // and multiple windows. 483 // and multiple windows.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698