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

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

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Flaky on all platforms, http://crbug.com/89173 80 // Flaky on all platforms, http://crbug.com/89173
81 #if !defined(OS_CHROMEOS) // ChromeOS opens tabs instead of windows for popups. 81 #if !defined(OS_CHROMEOS) // ChromeOS opens tabs instead of windows for popups.
82 IN_PROC_BROWSER_TEST_F(FastShutdown, SlowTermination) { 82 IN_PROC_BROWSER_TEST_F(FastShutdown, SlowTermination) {
83 // Need to run these tests on http:// since we only allow cookies on that (and 83 // Need to run these tests on http:// since we only allow cookies on that (and
84 // https obviously). 84 // https obviously).
85 ASSERT_TRUE(test_server()->Start()); 85 ASSERT_TRUE(test_server()->Start());
86 // This page has an unload handler. 86 // This page has an unload handler.
87 GURL url = test_server()->GetURL("files/fast_shutdown/on_unloader.html"); 87 GURL url = test_server()->GetURL("files/fast_shutdown/on_unloader.html");
88 EXPECT_EQ("", GetCookies(url)); 88 EXPECT_EQ("", GetCookies(url));
89 89
90 ui_test_utils::WindowedNotificationObserver window_observer( 90 content::WindowedNotificationObserver window_observer(
91 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 91 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
92 content::NotificationService::AllSources()); 92 content::NotificationService::AllSources());
93 ui_test_utils::NavigateToURLWithDisposition( 93 ui_test_utils::NavigateToURLWithDisposition(
94 browser(), url, NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); 94 browser(), url, NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE);
95 window_observer.Wait(); 95 window_observer.Wait();
96 96
97 // Close the new window, removing the one and only beforeunload handler. 97 // Close the new window, removing the one and only beforeunload handler.
98 ASSERT_EQ(2u, BrowserList::size()); 98 ASSERT_EQ(2u, BrowserList::size());
99 BrowserList::const_iterator i = BrowserList::begin(); 99 BrowserList::const_iterator i = BrowserList::begin();
100 ++i; 100 ++i;
101 chrome::CloseWindow(*i); 101 chrome::CloseWindow(*i);
102 102
103 // Need to wait for the renderer process to shutdown to ensure that we got the 103 // Need to wait for the renderer process to shutdown to ensure that we got the
104 // set cookies IPC. 104 // set cookies IPC.
105 ui_test_utils::WindowedNotificationObserver renderer_shutdown_observer( 105 content::WindowedNotificationObserver renderer_shutdown_observer(
106 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 106 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
107 content::NotificationService::AllSources()); 107 content::NotificationService::AllSources());
108 // Close the tab. This should launch the unload handler, which sets a cookie 108 // Close the tab. This should launch the unload handler, which sets a cookie
109 // that's stored to disk. 109 // that's stored to disk.
110 chrome::CloseTab(browser()); 110 chrome::CloseTab(browser());
111 renderer_shutdown_observer.Wait(); 111 renderer_shutdown_observer.Wait();
112 112
113 113
114 EXPECT_EQ("unloaded=ohyeah", GetCookies(url)); 114 EXPECT_EQ("unloaded=ohyeah", GetCookies(url));
115 } 115 }
116 #endif 116 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/plugin_apitest.cc ('k') | chrome/browser/geolocation/geolocation_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698