| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 return; // Test only applicable if restoring popups. | 260 return; // Test only applicable if restoring popups. |
| 261 | 261 |
| 262 NavigateToURL(url1_); | 262 NavigateToURL(url1_); |
| 263 | 263 |
| 264 // Make sure we have one window. | 264 // Make sure we have one window. |
| 265 int window_count; | 265 int window_count; |
| 266 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 266 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 267 ASSERT_EQ(1, window_count); | 267 ASSERT_EQ(1, window_count); |
| 268 | 268 |
| 269 // Open a popup. | 269 // Open a popup. |
| 270 ASSERT_TRUE(automation()->OpenNewBrowserWindow(BrowserProxy::TYPE_POPUP, | 270 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_POPUP, |
| 271 true)); | 271 true)); |
| 272 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 272 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 273 ASSERT_EQ(2, window_count); | 273 ASSERT_EQ(2, window_count); |
| 274 | 274 |
| 275 // Restart and make sure we have only one window with one tab and the url | 275 // Restart and make sure we have only one window with one tab and the url |
| 276 // is url1_. | 276 // is url1_. |
| 277 QuitBrowserAndRestore(1); | 277 QuitBrowserAndRestore(1); |
| 278 | 278 |
| 279 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 279 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 280 ASSERT_EQ(2, window_count); | 280 ASSERT_EQ(2, window_count); |
| 281 | 281 |
| 282 scoped_refptr<BrowserProxy> browser_proxy1( | 282 scoped_refptr<BrowserProxy> browser_proxy1( |
| 283 automation()->GetBrowserWindow(0)); | 283 automation()->GetBrowserWindow(0)); |
| 284 ASSERT_TRUE(browser_proxy1.get()); | 284 ASSERT_TRUE(browser_proxy1.get()); |
| 285 | 285 |
| 286 scoped_refptr<BrowserProxy> browser_proxy2( | 286 scoped_refptr<BrowserProxy> browser_proxy2( |
| 287 automation()->GetBrowserWindow(1)); | 287 automation()->GetBrowserWindow(1)); |
| 288 ASSERT_TRUE(browser_proxy2.get()); | 288 ASSERT_TRUE(browser_proxy2.get()); |
| 289 | 289 |
| 290 BrowserProxy::Type type1, type2; | 290 Browser::Type type1, type2; |
| 291 ASSERT_TRUE(browser_proxy1->GetType(&type1)); | 291 ASSERT_TRUE(browser_proxy1->GetType(&type1)); |
| 292 ASSERT_TRUE(browser_proxy2->GetType(&type2)); | 292 ASSERT_TRUE(browser_proxy2->GetType(&type2)); |
| 293 | 293 |
| 294 // The order of whether the normal window or popup is first depends upon | 294 // The order of whether the normal window or popup is first depends upon |
| 295 // activation order, which is not necessarily consistant across runs. | 295 // activation order, which is not necessarily consistant across runs. |
| 296 if (type1 == BrowserProxy::TYPE_NORMAL) { | 296 if (type1 == Browser::TYPE_NORMAL) { |
| 297 EXPECT_EQ(type2, BrowserProxy::TYPE_POPUP); | 297 EXPECT_EQ(type2, Browser::TYPE_POPUP); |
| 298 } else { | 298 } else { |
| 299 EXPECT_EQ(type1, BrowserProxy::TYPE_POPUP); | 299 EXPECT_EQ(type1, Browser::TYPE_POPUP); |
| 300 EXPECT_EQ(type2, BrowserProxy::TYPE_NORMAL); | 300 EXPECT_EQ(type2, Browser::TYPE_NORMAL); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 | 304 |
| 305 #if defined(OS_WIN) | 305 #if defined(OS_WIN) |
| 306 // Creates a browser, goes incognito, closes browser, launches and make sure | 306 // Creates a browser, goes incognito, closes browser, launches and make sure |
| 307 // we don't restore. | 307 // we don't restore. |
| 308 TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) { | 308 TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) { |
| 309 NavigateToURL(url1_); | 309 NavigateToURL(url1_); |
| 310 | 310 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // Creates two windows, closes one, restores, make sure only one window open. | 350 // Creates two windows, closes one, restores, make sure only one window open. |
| 351 TEST_F(SessionRestoreUITest, TwoWindowsCloseOneRestoreOnlyOne) { | 351 TEST_F(SessionRestoreUITest, TwoWindowsCloseOneRestoreOnlyOne) { |
| 352 NavigateToURL(url1_); | 352 NavigateToURL(url1_); |
| 353 | 353 |
| 354 // Make sure we have one window. | 354 // Make sure we have one window. |
| 355 int window_count; | 355 int window_count; |
| 356 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 356 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 357 ASSERT_EQ(1, window_count); | 357 ASSERT_EQ(1, window_count); |
| 358 | 358 |
| 359 // Open a second window. | 359 // Open a second window. |
| 360 ASSERT_TRUE(automation()->OpenNewBrowserWindow(BrowserProxy::TYPE_NORMAL, | 360 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, |
| 361 true)); | 361 true)); |
| 362 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 362 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 363 ASSERT_EQ(2, window_count); | 363 ASSERT_EQ(2, window_count); |
| 364 | 364 |
| 365 // Close it. | 365 // Close it. |
| 366 CloseWindow(1, 2); | 366 CloseWindow(1, 2); |
| 367 | 367 |
| 368 // Restart and make sure we have only one window with one tab and the url | 368 // Restart and make sure we have only one window with one tab and the url |
| 369 // is url1_. | 369 // is url1_. |
| 370 QuitBrowserAndRestore(1); | 370 QuitBrowserAndRestore(1); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); | 463 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); |
| 464 tab_proxy = browser_proxy->GetTab(tab_count - 1); | 464 tab_proxy = browser_proxy->GetTab(tab_count - 1); |
| 465 ASSERT_TRUE(tab_proxy.get() != NULL); | 465 ASSERT_TRUE(tab_proxy.get() != NULL); |
| 466 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); | 466 ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); |
| 467 | 467 |
| 468 ASSERT_EQ(expected_process_count, GetBrowserProcessCount()); | 468 ASSERT_EQ(expected_process_count, GetBrowserProcessCount()); |
| 469 } | 469 } |
| 470 #endif | 470 #endif |
| 471 | 471 |
| 472 } // namespace | 472 } // namespace |
| OLD | NEW |