| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/settings_window_manager.h" | 5 #include "chrome/browser/ui/settings_window_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
| 15 #include "chrome/browser/ui/browser_iterator.h" | 14 #include "chrome/browser/ui/browser_iterator.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/chrome_pages.h" | 16 #include "chrome/browser/ui/chrome_pages.h" |
| 18 #include "chrome/browser/ui/settings_window_manager_observer.h" | 17 #include "chrome/browser/ui/settings_window_manager_observer.h" |
| 19 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 test_profile_ = profile; | 87 test_profile_ = profile; |
| 89 closure.Run(); | 88 closure.Run(); |
| 90 } | 89 } |
| 91 } | 90 } |
| 92 | 91 |
| 93 void ShowSettingsForProfile(Profile* profile) { | 92 void ShowSettingsForProfile(Profile* profile) { |
| 94 settings_manager_->ShowChromePageForProfile( | 93 settings_manager_->ShowChromePageForProfile( |
| 95 profile, GURL(chrome::kChromeUISettingsURL)); | 94 profile, GURL(chrome::kChromeUISettingsURL)); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void CloseBrowserSynchronously(Browser* browser) { | |
| 99 content::WindowedNotificationObserver observer( | |
| 100 chrome::NOTIFICATION_BROWSER_CLOSED, | |
| 101 content::NotificationService::AllSources()); | |
| 102 browser->window()->Close(); | |
| 103 observer.Wait(); | |
| 104 } | |
| 105 | |
| 106 void CloseNonDefaultBrowsers() { | 97 void CloseNonDefaultBrowsers() { |
| 107 std::list<Browser*> browsers_to_close; | 98 std::list<Browser*> browsers_to_close; |
| 108 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 99 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 109 if (*it != browser()) | 100 if (*it != browser()) |
| 110 browsers_to_close.push_back(*it); | 101 browsers_to_close.push_back(*it); |
| 111 } | 102 } |
| 112 for (std::list<Browser*>::iterator iter = browsers_to_close.begin(); | 103 for (std::list<Browser*>::iterator iter = browsers_to_close.begin(); |
| 113 iter != browsers_to_close.end(); ++iter) { | 104 iter != browsers_to_close.end(); ++iter) { |
| 114 CloseBrowserSynchronously(*iter); | 105 CloseBrowserSynchronously(*iter); |
| 115 } | 106 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 197 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 207 | 198 |
| 208 // Downloads should open in an existing browser window. | 199 // Downloads should open in an existing browser window. |
| 209 chrome::ShowDownloads(browser()); | 200 chrome::ShowDownloads(browser()); |
| 210 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 201 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
| 211 | 202 |
| 212 // About should open a new browser window. | 203 // About should open a new browser window. |
| 213 chrome::ShowAboutChrome(browser()); | 204 chrome::ShowAboutChrome(browser()); |
| 214 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); | 205 EXPECT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 215 } | 206 } |
| OLD | NEW |