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

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

Issue 2827035: Disable BrowserCloseUnload on Linux (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/test/automation/browser_proxy.h" 11 #include "chrome/test/automation/browser_proxy.h"
12 #include "chrome/test/automation/tab_proxy.h" 12 #include "chrome/test/automation/tab_proxy.h"
13 #include "chrome/test/automation/window_proxy.h" 13 #include "chrome/test/automation/window_proxy.h"
14 #include "chrome/test/ui/ui_test.h" 14 #include "chrome/test/ui/ui_test.h"
15 #include "net/url_request/url_request_unittest.h" 15 #include "net/url_request/url_request_unittest.h"
16 #include "views/event.h" 16 #include "views/event.h"
17 17
18 #if defined(OS_LINUX) 18 #if defined(OS_LINUX)
19 // http://crbug.com/47575 19 // http://crbug.com/47575
20 #define MAYBE_BrowserCloseNoUnloadListeners \ 20 #define MAYBE_BrowserCloseNoUnloadListeners \
21 DISABLED_BrowserCloseNoUnloadListeners 21 DISABLED_BrowserCloseNoUnloadListeners
22 #define MAYBE_BrowserCloseUnload DISABLED_BrowserCloseUnload
22 #else 23 #else
23 #define MAYBE_BrowserCloseNoUnloadListeners BrowserCloseNoUnloadListeners 24 #define MAYBE_BrowserCloseNoUnloadListeners BrowserCloseNoUnloadListeners
25 #define MAYBE_BrowserCloseUnload BrowserCloseUnload
24 #endif 26 #endif
25 27
26 const std::string NOLISTENERS_HTML = 28 const std::string NOLISTENERS_HTML =
27 "<html><head><title>nolisteners</title></head><body></body></html>"; 29 "<html><head><title>nolisteners</title></head><body></body></html>";
28 30
29 const std::string UNLOAD_HTML = 31 const std::string UNLOAD_HTML =
30 "<html><head><title>unload</title></head><body>" 32 "<html><head><title>unload</title></head><body>"
31 "<script>window.onunload=function(e){}</script></body></html>"; 33 "<script>window.onunload=function(e){}</script></body></html>";
32 34
33 const std::string BEFORE_UNLOAD_HTML = 35 const std::string BEFORE_UNLOAD_HTML =
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 NavigateToNolistenersFileTwice(); 279 NavigateToNolistenersFileTwice();
278 ASSERT_TRUE(IsBrowserRunning()); 280 ASSERT_TRUE(IsBrowserRunning());
279 } 281 }
280 282
281 // Tests closing the browser on a page with no unload listeners registered. 283 // Tests closing the browser on a page with no unload listeners registered.
282 TEST_F(UnloadTest, MAYBE_BrowserCloseNoUnloadListeners) { 284 TEST_F(UnloadTest, MAYBE_BrowserCloseNoUnloadListeners) {
283 LoadUrlAndQuitBrowser(NOLISTENERS_HTML, L"nolisteners"); 285 LoadUrlAndQuitBrowser(NOLISTENERS_HTML, L"nolisteners");
284 } 286 }
285 287
286 // Tests closing the browser on a page with an unload listener registered. 288 // Tests closing the browser on a page with an unload listener registered.
287 TEST_F(UnloadTest, BrowserCloseUnload) { 289 TEST_F(UnloadTest, MAYBE_BrowserCloseUnload) {
288 LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload"); 290 LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload");
289 } 291 }
290 292
291 // Tests closing the browser with a beforeunload handler and clicking 293 // Tests closing the browser with a beforeunload handler and clicking
292 // OK in the beforeunload confirm dialog. 294 // OK in the beforeunload confirm dialog.
293 TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) { 295 TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) {
294 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 296 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
295 ASSERT_TRUE(browser.get()); 297 ASSERT_TRUE(browser.get());
296 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); 298 NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload");
297 299
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_timeout_ms())); 447 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_timeout_ms()));
446 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); 448 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab());
447 ASSERT_TRUE(main_tab.get()); 449 ASSERT_TRUE(main_tab.get());
448 std::wstring main_title; 450 std::wstring main_title;
449 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); 451 EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
450 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); 452 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
451 } 453 }
452 454
453 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 455 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
454 // and multiple windows. 456 // and multiple windows.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698