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

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

Issue 1644773003: Remove BrowserIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-desktop-1
Patch Set: . Created 4 years, 10 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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_commands.h" 13 #include "chrome/browser/ui/browser_commands.h"
14 #include "chrome/browser/ui/browser_finder.h" 14 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/browser/ui/browser_iterator.h" 15 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 16 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/test/browser_test_utils.h" 22 #include "content/public/test/browser_test_utils.h"
23 #include "net/test/embedded_test_server/embedded_test_server.h" 23 #include "net/test/embedded_test_server/embedded_test_server.h"
24 24
25 using content::BrowserThread; 25 using content::BrowserThread;
(...skipping 25 matching lines...) Expand all
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, NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE);
57 window_observer.Wait(); 57 window_observer.Wait();
58 58
59 // Close the new window, removing the one and only beforeunload handler. 59 // Close the new window, removing the one and only beforeunload handler.
60 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); 60 ASSERT_EQ(2u, chrome::GetTotalBrowserCount());
61 chrome::BrowserIterator it; 61 chrome::CloseWindow(*(BrowserList::GetInstance()->begin() + 1));
62 it.Next();
63 chrome::CloseWindow(*it);
64 62
65 // Need to wait for the renderer process to shutdown to ensure that we got the 63 // Need to wait for the renderer process to shutdown to ensure that we got the
66 // set cookies IPC. 64 // set cookies IPC.
67 content::RenderProcessHostWatcher renderer_shutdown_observer( 65 content::RenderProcessHostWatcher renderer_shutdown_observer(
68 browser()->tab_strip_model()->GetActiveWebContents(), 66 browser()->tab_strip_model()->GetActiveWebContents(),
69 content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION); 67 content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION);
70 // Close the tab. This should launch the unload handler, which sets a cookie 68 // Close the tab. This should launch the unload handler, which sets a cookie
71 // that's stored to disk. 69 // that's stored to disk.
72 chrome::CloseTab(browser()); 70 chrome::CloseTab(browser());
73 renderer_shutdown_observer.Wait(); 71 renderer_shutdown_observer.Wait();
74 72
75 EXPECT_EQ("unloaded=ohyeah", content::GetCookies(browser()->profile(), url)); 73 EXPECT_EQ("unloaded=ohyeah", content::GetCookies(browser()->profile(), url));
76 } 74 }
77 #endif 75 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/window_open_apitest.cc ('k') | chrome/browser/lifetime/application_lifetime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698