OLD | NEW |
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 Loading... |
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 |
OLD | NEW |