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

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

Issue 2825024: Marks BrowserCloseNoUnloadListeners flaky.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 6 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
« 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)
19 // http://crbug.com/47575
20 #define MAYBE_BrowserCloseNoUnloadListeners FLAKY_BrowserCloseNoUnloadListeners
21 #else
22 #define MAYBE_BrowserCloseNoUnloadListeners BrowserCloseNoUnloadListeners
23 #endif
24
18 const std::string NOLISTENERS_HTML = 25 const std::string NOLISTENERS_HTML =
19 "<html><head><title>nolisteners</title></head><body></body></html>"; 26 "<html><head><title>nolisteners</title></head><body></body></html>";
20 27
21 const std::string UNLOAD_HTML = 28 const std::string UNLOAD_HTML =
22 "<html><head><title>unload</title></head><body>" 29 "<html><head><title>unload</title></head><body>"
23 "<script>window.onunload=function(e){}</script></body></html>"; 30 "<script>window.onunload=function(e){}</script></body></html>";
24 31
25 const std::string BEFORE_UNLOAD_HTML = 32 const std::string BEFORE_UNLOAD_HTML =
26 "<html><head><title>beforeunload</title></head><body>" 33 "<html><head><title>beforeunload</title></head><body>"
27 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" 34 "<script>window.onbeforeunload=function(e){return 'foo'}</script>"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) 271 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
265 return; 272 return;
266 273
267 NavigateToDataURL(INFINITE_BEFORE_UNLOAD_HTML, L"infinitebeforeunload"); 274 NavigateToDataURL(INFINITE_BEFORE_UNLOAD_HTML, L"infinitebeforeunload");
268 // Must navigate to a non-data URL to trigger cross-site codepath. 275 // Must navigate to a non-data URL to trigger cross-site codepath.
269 NavigateToNolistenersFileTwice(); 276 NavigateToNolistenersFileTwice();
270 ASSERT_TRUE(IsBrowserRunning()); 277 ASSERT_TRUE(IsBrowserRunning());
271 } 278 }
272 279
273 // Tests closing the browser on a page with no unload listeners registered. 280 // Tests closing the browser on a page with no unload listeners registered.
274 TEST_F(UnloadTest, BrowserCloseNoUnloadListeners) { 281 TEST_F(UnloadTest, MAYBE_BrowserCloseNoUnloadListeners) {
275 LoadUrlAndQuitBrowser(NOLISTENERS_HTML, L"nolisteners"); 282 LoadUrlAndQuitBrowser(NOLISTENERS_HTML, L"nolisteners");
276 } 283 }
277 284
278 // Tests closing the browser on a page with an unload listener registered. 285 // Tests closing the browser on a page with an unload listener registered.
279 TEST_F(UnloadTest, BrowserCloseUnload) { 286 TEST_F(UnloadTest, BrowserCloseUnload) {
280 LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload"); 287 LoadUrlAndQuitBrowser(UNLOAD_HTML, L"unload");
281 } 288 }
282 289
283 // Tests closing the browser with a beforeunload handler and clicking 290 // Tests closing the browser with a beforeunload handler and clicking
284 // OK in the beforeunload confirm dialog. 291 // OK in the beforeunload confirm dialog.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_timeout_ms())); 444 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_timeout_ms()));
438 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); 445 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab());
439 ASSERT_TRUE(main_tab.get()); 446 ASSERT_TRUE(main_tab.get());
440 std::wstring main_title; 447 std::wstring main_title;
441 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); 448 EXPECT_TRUE(main_tab->GetTabTitle(&main_title));
442 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); 449 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title);
443 } 450 }
444 451
445 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 452 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
446 // and multiple windows. 453 // 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