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

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

Issue 2909943003: Removing useless Win7 checks + standardize its use (Closed)
Patch Set: Various nits Created 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #if defined(OS_POSIX) 5 #if defined(OS_POSIX)
6 #include <signal.h> 6 #include <signal.h>
7 #endif 7 #endif
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/render_frame_host.h" 27 #include "content/public/browser/render_frame_host.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "content/public/common/content_switches.h" 29 #include "content/public/common/content_switches.h"
30 #include "content/public/test/browser_test_utils.h" 30 #include "content/public/test/browser_test_utils.h"
31 #include "net/test/embedded_test_server/embedded_test_server.h" 31 #include "net/test/embedded_test_server/embedded_test_server.h"
32 #include "net/test/url_request/url_request_mock_http_job.h" 32 #include "net/test/url_request/url_request_mock_http_job.h"
33 #include "net/url_request/url_request_test_util.h" 33 #include "net/url_request/url_request_test_util.h"
34 34
35 #if defined(OS_WIN)
36 // For version specific disabled tests below (http://crbug.com/267597).
37 #include "base/win/windows_version.h"
38 #endif
39
40 using base::TimeDelta; 35 using base::TimeDelta;
41 using content::BrowserThread; 36 using content::BrowserThread;
42 37
43 const char NOLISTENERS_HTML[] = 38 const char NOLISTENERS_HTML[] =
44 "<html><head><title>nolisteners</title></head><body></body></html>"; 39 "<html><head><title>nolisteners</title></head><body></body></html>";
45 40
46 const char UNLOAD_HTML[] = 41 const char UNLOAD_HTML[] =
47 "<html><head><title>unload</title></head><body>" 42 "<html><head><title>unload</title></head><body>"
48 "<script>window.onunload=function(e){}</script></body></html>"; 43 "<script>window.onunload=function(e){}</script></body></html>";
49 44
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 EXPECT_EQ("", GetCookies("unload_sleep_before_cookie")); 749 EXPECT_EQ("", GetCookies("unload_sleep_before_cookie"));
755 750
756 content::WindowedNotificationObserver window_observer( 751 content::WindowedNotificationObserver window_observer(
757 chrome::NOTIFICATION_BROWSER_CLOSED, 752 chrome::NOTIFICATION_BROWSER_CLOSED,
758 content::NotificationService::AllSources()); 753 content::NotificationService::AllSources());
759 chrome::CloseTab(browser()); 754 chrome::CloseTab(browser());
760 window_observer.Wait(); 755 window_observer.Wait();
761 } 756 }
762 757
763 // Fails on Mac, Linux, Win7 (http://crbug.com/301173). 758 // Fails on Mac, Linux, Win7 (http://crbug.com/301173).
759 // Flaky on Windows bots (http://crbug.com/267597).
764 IN_PROC_BROWSER_TEST_F(FastUnloadTest, DISABLED_ClosingLastTabFinishesUnload) { 760 IN_PROC_BROWSER_TEST_F(FastUnloadTest, DISABLED_ClosingLastTabFinishesUnload) {
765 #if defined(OS_WIN)
766 // Flaky on Win7+ bots (http://crbug.com/267597).
767 if (base::win::GetVersion() >= base::win::VERSION_WIN7)
768 return;
769 #endif
770 // Check for cookie set in unload handler of PRE_ test. 761 // Check for cookie set in unload handler of PRE_ test.
771 NavigateToPage("no_listeners"); 762 NavigateToPage("no_listeners");
772 EXPECT_EQ("unloaded=ohyeah", GetCookies("no_listeners")); 763 EXPECT_EQ("unloaded=ohyeah", GetCookies("no_listeners"));
773 } 764 }
774 765
775 // Test that fast-tab-close does not break window close. 766 // Test that fast-tab-close does not break window close.
776 IN_PROC_BROWSER_TEST_F(FastUnloadTest, PRE_WindowCloseFinishesUnload) { 767 IN_PROC_BROWSER_TEST_F(FastUnloadTest, PRE_WindowCloseFinishesUnload) {
777 NavigateToPage("no_listeners"); 768 NavigateToPage("no_listeners");
778 769
779 // The unload handler sleeps before setting the cookie to catch cases when 770 // The unload handler sleeps before setting the cookie to catch cases when
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 base::Bind(&UnloadResults::AddSuccess, base::Unretained(&unload_results)), 916 base::Bind(&UnloadResults::AddSuccess, base::Unretained(&unload_results)),
926 base::Bind(&UnloadResults::AddAbort, base::Unretained(&unload_results)), 917 base::Bind(&UnloadResults::AddAbort, base::Unretained(&unload_results)),
927 true); 918 true);
928 window_observer.Wait(); 919 window_observer.Wait();
929 EXPECT_EQ(1, unload_results.get_successes()); 920 EXPECT_EQ(1, unload_results.get_successes());
930 EXPECT_EQ(0, unload_results.get_aborts()); 921 EXPECT_EQ(0, unload_results.get_aborts());
931 } 922 }
932 923
933 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs 924 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs
934 // and multiple windows. 925 // and multiple windows.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698