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

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

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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) 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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // https obviously). 46 // https obviously).
47 ASSERT_TRUE(embedded_test_server()->Start()); 47 ASSERT_TRUE(embedded_test_server()->Start());
48 // This page has an unload handler. 48 // This page has an unload handler.
49 GURL url = embedded_test_server()->GetURL("/fast_shutdown/on_unloader.html"); 49 GURL url = embedded_test_server()->GetURL("/fast_shutdown/on_unloader.html");
50 EXPECT_EQ("", content::GetCookies(browser()->profile(), url)); 50 EXPECT_EQ("", content::GetCookies(browser()->profile(), url));
51 51
52 content::WindowedNotificationObserver window_observer( 52 content::WindowedNotificationObserver window_observer(
53 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 53 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
54 content::NotificationService::AllSources()); 54 content::NotificationService::AllSources());
55 ui_test_utils::NavigateToURLWithDisposition( 55 ui_test_utils::NavigateToURLWithDisposition(
56 browser(), url, NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE); 56 browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB,
57 ui_test_utils::BROWSER_TEST_NONE);
57 window_observer.Wait(); 58 window_observer.Wait();
58 59
59 // Close the new window, removing the one and only beforeunload handler. 60 // Close the new window, removing the one and only beforeunload handler.
60 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); 61 ASSERT_EQ(2u, chrome::GetTotalBrowserCount());
61 chrome::CloseWindow(*(BrowserList::GetInstance()->begin() + 1)); 62 chrome::CloseWindow(*(BrowserList::GetInstance()->begin() + 1));
62 63
63 // Need to wait for the renderer process to shutdown to ensure that we got the 64 // Need to wait for the renderer process to shutdown to ensure that we got the
64 // set cookies IPC. 65 // set cookies IPC.
65 content::RenderProcessHostWatcher renderer_shutdown_observer( 66 content::RenderProcessHostWatcher renderer_shutdown_observer(
66 browser()->tab_strip_model()->GetActiveWebContents(), 67 browser()->tab_strip_model()->GetActiveWebContents(),
67 content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION); 68 content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
68 // Close the tab. This should launch the unload handler, which sets a cookie 69 // Close the tab. This should launch the unload handler, which sets a cookie
69 // that's stored to disk. 70 // that's stored to disk.
70 chrome::CloseTab(browser()); 71 chrome::CloseTab(browser());
71 renderer_shutdown_observer.Wait(); 72 renderer_shutdown_observer.Wait();
72 73
73 EXPECT_EQ("unloaded=ohyeah", content::GetCookies(browser()->profile(), url)); 74 EXPECT_EQ("unloaded=ohyeah", content::GetCookies(browser()->profile(), url));
74 } 75 }
75 #endif 76 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/window_open_apitest.cc ('k') | chrome/browser/favicon/content_favicon_driver_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698