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/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 | 234 |
235 // Tests closing the browser on a page with an unload listener registered. | 235 // Tests closing the browser on a page with an unload listener registered. |
236 TEST_F(UnloadTest, BrowserCloseUnload) { | 236 TEST_F(UnloadTest, BrowserCloseUnload) { |
237 LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload"); | 237 LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload"); |
238 } | 238 } |
239 | 239 |
240 // Tests closing the browser with a beforeunload handler and clicking | 240 // Tests closing the browser with a beforeunload handler and clicking |
241 // OK in the beforeunload confirm dialog. | 241 // OK in the beforeunload confirm dialog. |
242 #if !defined(OS_LINUX) | 242 #if !defined(OS_LINUX) |
243 TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) { | 243 TEST_F(UnloadTest, DISABLED_BrowserCloseBeforeUnloadOK) { |
244 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 244 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
245 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); | 245 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); |
246 | 246 |
247 CloseBrowserAsync(browser.get()); | 247 CloseBrowserAsync(browser.get()); |
248 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); | 248 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); |
249 WaitForBrowserClosed(); | 249 WaitForBrowserClosed(); |
250 EXPECT_FALSE(IsBrowserRunning()); | 250 EXPECT_FALSE(IsBrowserRunning()); |
251 } | 251 } |
252 | 252 |
253 // Tests closing the browser with a beforeunload handler and clicking | 253 // Tests closing the browser with a beforeunload handler and clicking |
254 // CANCEL in the beforeunload confirm dialog. | 254 // CANCEL in the beforeunload confirm dialog. |
255 TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) { | 255 TEST_F(UnloadTest, DISABLED_BrowserCloseBeforeUnloadCancel) { |
256 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 256 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
257 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); | 257 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); |
258 | 258 |
259 CloseBrowserAsync(browser.get()); | 259 CloseBrowserAsync(browser.get()); |
260 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_CANCEL); | 260 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_CANCEL); |
261 WaitForBrowserClosed(); | 261 WaitForBrowserClosed(); |
262 EXPECT_TRUE(IsBrowserRunning()); | 262 EXPECT_TRUE(IsBrowserRunning()); |
263 | 263 |
264 CloseBrowserAsync(browser.get()); | 264 CloseBrowserAsync(browser.get()); |
265 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); | 265 ClickModalDialogButton(MessageBoxFlags::DIALOGBUTTON_OK); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); | 365 scoped_refptr<TabProxy> main_tab(main_browser_proxy->GetActiveTab()); |
366 ASSERT_TRUE(main_tab.get()); | 366 ASSERT_TRUE(main_tab.get()); |
367 std::wstring main_title; | 367 std::wstring main_title; |
368 ASSERT_TRUE(main_tab.get() != NULL); | 368 ASSERT_TRUE(main_tab.get() != NULL); |
369 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); | 369 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); |
370 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); | 370 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); |
371 } | 371 } |
372 | 372 |
373 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 373 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
374 // and multiple windows. | 374 // and multiple windows. |
OLD | NEW |