OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/process/launch.h" | 6 #include "base/process/launch.h" |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Create an incognito window. | 120 // Create an incognito window. |
121 chrome::NewIncognitoWindow(browser()); | 121 chrome::NewIncognitoWindow(browser()); |
122 | 122 |
123 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); | 123 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); |
124 ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(browser()->profile(), | 124 ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(browser()->profile(), |
125 browser()->host_desktop_type())); | 125 browser()->host_desktop_type())); |
126 | 126 |
127 // Close the first window. | 127 // Close the first window. |
128 Profile* profile = browser()->profile(); | 128 Profile* profile = browser()->profile(); |
129 chrome::HostDesktopType host_desktop_type = browser()->host_desktop_type(); | 129 ui::HostDesktopType host_desktop_type = browser()->host_desktop_type(); |
130 content::WindowedNotificationObserver observer( | 130 content::WindowedNotificationObserver observer( |
131 chrome::NOTIFICATION_BROWSER_CLOSED, | 131 chrome::NOTIFICATION_BROWSER_CLOSED, |
132 content::NotificationService::AllSources()); | 132 content::NotificationService::AllSources()); |
133 chrome::CloseWindow(browser()); | 133 chrome::CloseWindow(browser()); |
134 observer.Wait(); | 134 observer.Wait(); |
135 | 135 |
136 // There should only be the incognito window open now. | 136 // There should only be the incognito window open now. |
137 ASSERT_EQ(1u, chrome::GetTotalBrowserCount()); | 137 ASSERT_EQ(1u, chrome::GetTotalBrowserCount()); |
138 ASSERT_EQ(0u, chrome::GetTabbedBrowserCount(profile, host_desktop_type)); | 138 ASSERT_EQ(0u, chrome::GetTabbedBrowserCount(profile, host_desktop_type)); |
139 | 139 |
140 // Run with just an URL specified, no --incognito switch. | 140 // Run with just an URL specified, no --incognito switch. |
141 base::FilePath test_file_path = ui_test_utils::GetTestFilePath( | 141 base::FilePath test_file_path = ui_test_utils::GetTestFilePath( |
142 base::FilePath(), base::FilePath().AppendASCII("empty.html")); | 142 base::FilePath(), base::FilePath().AppendASCII("empty.html")); |
143 base::CommandLine new_command_line(GetCommandLineForRelaunch()); | 143 base::CommandLine new_command_line(GetCommandLineForRelaunch()); |
144 new_command_line.AppendArgPath(test_file_path); | 144 new_command_line.AppendArgPath(test_file_path); |
145 content::WindowedNotificationObserver tab_observer( | 145 content::WindowedNotificationObserver tab_observer( |
146 chrome::NOTIFICATION_TAB_ADDED, | 146 chrome::NOTIFICATION_TAB_ADDED, |
147 content::NotificationService::AllSources()); | 147 content::NotificationService::AllSources()); |
148 Relaunch(new_command_line); | 148 Relaunch(new_command_line); |
149 tab_observer.Wait(); | 149 tab_observer.Wait(); |
150 | 150 |
151 // There should be one normal and one incognito window now. | 151 // There should be one normal and one incognito window now. |
152 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); | 152 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); |
153 ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(profile, host_desktop_type)); | 153 ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(profile, host_desktop_type)); |
154 } | 154 } |
155 | 155 |
156 #endif // !OS_MACOSX | 156 #endif // !OS_MACOSX |
OLD | NEW |